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)
How would you do this?
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;
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?
