Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,302 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
What's the best way to trace distance to the floor?? #252368
02/17/09 22:12
02/17/09 22:12
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
Hi
here's my version (the player keeps dropping slightly through the floor..? then jumping back up)
Quote:
trace_mode = ignore_me+ignore_passable+use_box;
result = trace(vector(my.x,my.y,my.z - my.z_offset),vector(my.x,my.y,my.z - 1000));
IF (result < 30) {
my.force2_z = -1 * result;
} ELSE {
my.force2_z -= 1 * time_step;
my.force2_z = max(-3,my.force2_z);
}
my.velocity_z += (time_step * my.force2_z) - (min(time_step*0.7,1) * my.velocity_z);
my.force_z = my.velocity_z * time_step;


How would you do this?

Re: What's the best way to trace distance to the floor?? [Re: RyuShinji] #252405
02/18/09 05:25
02/18/09 05:25
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
You should set player's z directly, depending on the value of "result". Don't use force_z, velocity_z, etc.


Gamestudio download | 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