Original Post
Hi guys,
I am using constant acceleration but am not sure what velocity to use in my collision detection. Like this (pseudo-code):
void MoveObjects(float time_span)
{
// add up all the forces
// compute next position using constant acceleration
// what velocity do I use now ?
// collision loop
do{
delta=time_span*velocity;
// see if anything collided
// then move to collision spot
// and record time
object.position += delta*time_span;
object.velocity = reflected velocity;
}while(time still left)
}
If after I accumulate the forces and get an acceleration and calculate the object''s next position it will be using the average velocity, but the ''real'' velocity (at the end of the frame) will be v=v + at. So I don''t get it. I want the collision loop to use linear movement so it seems logical to use the average velocity, but at the same time it isn''t the ''real'' velocity at the end of the last frame. Also, if I save the new velocity for the next frame and the current velocity gets altered in the collision response loop it messes things up. Any ideas ?