What's the best way to trace distance to the floor??

Posted By: RyuShinji

What's the best way to trace distance to the floor?? - 02/17/09 22:12

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?
Posted By: George

Re: What's the best way to trace distance to the floor?? - 02/18/09 05:25

You should set player's z directly, depending on the value of "result". Don't use force_z, velocity_z, etc.
© 2023 lite-C Forums