I myself commited some stupid mistakes when I started using the timestep variable. This is a note for any newbie reading this thread.

1. Remember the order operations are made... () first, /* second, +- last.
in this code:
Code:
my.x += speed + friction * time_step;


timestep will only affect friction, not the speed. to clarify this look at it as if it was doing this:
my.x += speed + (friction*time_step);
to correct this write your code to always make sure timestep will multiply everything like this:
Code:
my.x += (speed + friction) * time_step;



2. While you cant completely get rid of the problem of the different heights (the diagram someone provided earlier ilustrates this problem perfectly) what you can do is force the jump to at least make sure you have reached the desired height before stopping with something like this:
Code:
target_z = my.z + jump_height;
while(my.z < target_z)
{
my.z += jump_speed * time_step;
}



3. Of course when you force the jump to reach the desired height you may run into another problem... If you hit something along the way (ceiling) before reaching the jump height your character will remain "floating" trying to reach his target jump_height. To avoid this make sure you use c_move() for the movement and include a check for getting stuck by a collision in the while() condition.
It would look something like this:
Code:
target_z = my.z + jump_height;
result = 1;
while((my.z < target_z) && (result>0))
{
result = c_move(me,vector(0,0,(jump_speed*time_step)),nullvector,IGNORE_PASSABLE|GLIDE);
}



A note on c_move from the manuall to clarify what "result" is being used for:
Quote:
The c_move function returns the amount of distance covered. If the entity could not move at all due to being blocked by obstacles, it returns a negative value or 0.


Hope this helped someone.


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1