Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c_trace problem with models #423194
05/25/13 13:19
05/25/13 13:19
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
Hi,

I just created a gravity system with using c_trace. I store the height of player in a variable. There is not any problem when player stands on blocks. But I jumped on the a model, and I saw the height isn't calculated correctly. I'm using IGNORE_ME, IGNORE_PASSABLE and USE_BOX flags.

There is the c_trace part;

Code:
player_height = c_trace(player.x, vector(player.x, player.y, player.z - 1000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX);



I also add some screenshots (double F11 and height variable printed on screen)

On the model; (height is 7)


On the model; (double F11)


Another side;


And another weird thing is happening. If player move on the model, it also starts to move upward;


How can I solve those?

Thanks in advance.

Re: c_trace problem with models [Re: WickWoody] #423215
05/25/13 15:34
05/25/13 15:34
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
I solved that calculating height with changing max_z of model. But It is still starting to fly when I move on it.

Last edited by WickWoody; 05/25/13 15:36.
Re: c_trace problem with models [Re: WickWoody] #423216
05/25/13 16:00
05/25/13 16:00
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Do you call "me=player;" right before your c_trace?

Re: c_trace problem with models [Re: oliver2s] #423219
05/25/13 16:22
05/25/13 16:22
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
Of course, it works perfectly when player isn't on a model.

Re: c_trace problem with models [Re: WickWoody] #423224
05/25/13 18:11
05/25/13 18:11
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Code:
player_height = c_trace(player.x, vector(player.x, player.y, player.z - 1000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX);


I guess you set "player_height" to player.z? This would be wrong, because this is always the distance of the trace ray. It have to be something like this:

Code:
result = c_trace(player.x, vector(player.x, player.y, player.z - 1000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
if(result>0){player_height=hit.z;}


Re: c_trace problem with models [Re: oliver2s] #423230
05/25/13 21:04
05/25/13 21:04
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
No no, I don't set "player_height" to player.z . I have a little gravity code. There is;

Code:
player_height = c_trace(my.x, vector(my.x, my.y, my.z - 10000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX | SCAN_TEXTURE);
	if(player_height > 1) // oyuncu havadaysa
	{
		gravity_vector.z -= 1 * time_step; // asagi cek
	} else {
		if(is_player_jumping == 1) // if player isn't jumping, it will be 1
			movement_vector.z = 0; // ellesme
	}



I think, cause of wrong return of c_trace, my gravity function doesn't work :S

Re: c_trace problem with models [Re: WickWoody] #423259
05/27/13 05:26
05/27/13 05:26
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
What happens if u set the POLYGON flag of the model u stand on top ?


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: c_trace problem with models [Re: rayp] #423357
05/28/13 13:48
05/28/13 13:48
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
Yeah, it works. Thank you laugh

Re: c_trace problem with models [Re: WickWoody] #423390
05/29/13 04:51
05/29/13 04:51
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Your welcome.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;

Moderated by  HeelX, Spirit 

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