4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
c_trace problem with models
#423194
05/25/13 13:19
05/25/13 13:19
|
Joined: Oct 2009
Posts: 90
WickWoody
OP
Junior Member
|
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;
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
OP
Junior Member
|
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]
#423224
05/25/13 18:11
05/25/13 18:11
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
Expert
|
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
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:
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
OP
Junior Member
|
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;
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
|
|
|
|