Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, Ayumi, PeWi, Quad, VoroneTZ), 513 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Fullscreen Object Placement Problems #363826
03/14/11 21:29
03/14/11 21:29
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I have an entity that is attached to a vertex of another moving entity (a gun in player's hand). This is the simple code I use to keep the gun in place.
Code:
my.x = ptemp.x;
my.y = ptemp.y;
my.z = ptemp.z;


Ptemp is obviously a vector which keeps that specific vertex's position. The problem is, though, that in fullscreen the framerate of the game is lower, and the gun begins falling behind the player when he moves. All of a sudden the gun is behind the player's hand instead of in the place they should be.

What should I do to make it so the gun keeps up with the vertex? In windowed mode it's perfect.

Re: Fullscreen Object Placement Problems [Re: Valdsator] #363828
03/14/11 21:35
03/14/11 21:35
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You should read the FAQs, Section "Bad timing, again":

http://manual.3dgamestudio.net/afaq.htm


Always learn from history, to be sure you make the same mistakes again...
Re: Fullscreen Object Placement Problems [Re: Valdsator] #363829
03/14/11 21:36
03/14/11 21:36
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
hopfel Offline
User
hopfel  Offline
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
Too late -.-
You should set the position of the gun in the same frame you set the Positions of the player. For the fastest way you should write this three lines directly in your playerfunction under the animations or playermoves.

Last edited by hopfel; 03/14/11 21:36.

Hilf mir, dir zu helfen!
Re: Fullscreen Object Placement Problems [Re: hopfel] #363832
03/14/11 22:17
03/14/11 22:17
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Awesome, that worked. I'll also make sure to look at the FAQ next time.

But, one last problem. In windowed mode, the gun can't shoot through walls if clipping through them, but in fullscreen it can shoot through walls if the player entity is facing a very specific angle. This doesn't appear to be a problem with timing, as I have just tried to make the player entity create the bullets instead of the gun entity, but it results in the same thing. It has something to do with the position of the gun, because if I use the player's position for the ent_create, it doesn't clip through.

Anyone know what the problem might be?

Re: Fullscreen Object Placement Problems [Re: Valdsator] #363836
03/14/11 22:37
03/14/11 22:37
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Well, according to your description the bullet is either created inside the weapon and or player or outside and depending on the angle its the other way around. You should create the bullet at the front of the weapon, so it does not intersect with any other collision hulls, when it is created. Additionally the flags set in the c_move command in the bullet's action play a role for this.


Always learn from history, to be sure you make the same mistakes again...
Re: Fullscreen Object Placement Problems [Re: Uhrwerk] #364036
03/16/11 02:09
03/16/11 02:09
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Well, I played around with some flags on the c_move, tried to move the bullet in front of the gun, and tried slowing it down, but it does the same thing. I don't really understand what the framerate of the game might change about collision. I guess the bullet can't tell fast enough it's being spawned in a wall, so it continues moving, and once it checks to see if it's colliding with a block, it's too late.

Not sure how I could fix this. Here is the code I have.
Code:
action pbullet(){
	c_setminmax(me);
	set(my,BRIGHT);
	my.emask = ENABLE_BLOCK|ENABLE_ENTITY;
	my.event = pbulletdelete;
	var panrandom = integer(random(11));
	my.pan = you.pan - 5 + panrandom;
	while(1){
	c_move(me,vector(50 * time_step,0,0),nullvector,GLIDE|IGNORE_PASSABLE|IGNORE_YOU);
	wait(1);
	}
}

action pgun(){
	weapon = me;
	var cooldown = 5;
	var pistolsnd;
	set(my,PASSABLE);
	while(1){
		cooldown += 1 * time_step;
		if(key_j){
			if(cooldown >= 4){
				you = ent_create("bullet1.mdl",vector(my.x,my.y,my.z),pbullet);
				if(snd_playing(pistolsnd)){
					snd_stop(pistolsnd);
				}
				pistolsnd = snd_play(pistol,100,0);
				cooldown = 0;
			}
		}
	wait(1);
	}
}


I guess I could just scrap this code and not make the bullet a moving entity, but I think this problem could appear with many other things, so I want to learn how to fix it.

Thanks for the suggestions, by the way.

Re: Fullscreen Object Placement Problems [Re: Valdsator] #364081
03/16/11 13:21
03/16/11 13:21
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
I wouldn't suggest you make the bullet a moving entity. The bullet is moving through the wall because the spawn vector is inside the collision hull of the wall.

To fix this, you just need to move the spawn vector back away from the wall a bit.


Eats commas for breakfast.

Play Barony: Cursed Edition!

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1