There is still some flaw with my code before, I examined the code very carefully and found that I need to store the non-collision state, and restore it after one collision.In other words, I need to find the exact colliding time. If I don't, if I use the already collided time, the behaviour is very weird.
The modification that I made, was to use a set of variables to store the non-collision state just before collision, or it can be specified as a state buffer.
the pseudcode is:
updateState()
{
if not colliding
then store the state
if colliding
restore the state and execute the collision response
}
but there is a problem with low update rate computers, that is if the car's speed is too fast, the stored state's position might be a little far from the current state, if you restore it, there might be Temporal aliasing. which is not good....
anyway, I will continue the study on this, and update what I get.

Leave a comment