   Sort of Recursive Collision Algorithm?
  Hey everyone.I'll try to make this as clear as I can.Basically I'm trying to write the most realistic collision algorithm.This meaning, if the time delta between two frames is 3 seconds [hopefully that won't happen..] and object A, for example, is supposed to collide 6 times with other objects within these 3 seconds... That's a lot of collision calculations.The way I see it:0)variable dTime will store the time delta from last frame.1)I'll predict the next collision time for ALL objects and take the smallest time [meaning the first collision] within the dTime limits and call it sT.2)I will then let the objects' positions update according to their velocity*sT [up until the point of the first collision].3)The collided objects' response will be triggered [changes in velocity].4)I will then take the remaining time left for the frame [dTime - sT] and go back to step 0. Only this time, variable dTime will store (dTime - sT).Problem 1...Inefficient perhaps? Too many calculations?Problem 2...The delta time is increasing as I add collision calculations making the calculations incorrect and defecting timing.I'd greatly appreciate any help.I've searched for this topic and have found nothing specific.Thanks in advance,Ori   
  I didnt bother to read it all cause it looks a bit squashed, but the theory atleast is.1.Find first occuring collision2.Set Time (orDeltaTime) ot just before collision3.Handle Collision by (And only by) changing velocitys (not positions)4.Restart at 1 with new first collisionThis will require you to have a GetCollision() command which returns the two objects and the time, then you want to simulate(move into position) the world with the deltaTime (or DeltaDeltaTime) and restart there.Problems occur with constant forces, gravity,springs and so on.Also it depends what system you are using but if the time frames vary dramatically you will also pick up problems   ;Quote:Original post by dawidjoubertI didnt bother to read it all cause it looks a bit squashed, but the theory atleast is.1.Find first occuring collision2.Set Time (orDeltaTime) ot just before collision3.Handle Collision by (And only by) changing velocitys (not positions)4.Restart at 1 with new first collisionThis will require you to have a GetCollision() command which returns the two objects and the time, then you want to simulate(move into position) the world with the deltaTime (or DeltaDeltaTime) and restart there.Seconded. This method ensures perfect collision detection and response. But creates some difficulties with prolonged contact (or at least, I'm having some trouble with it).Quote:Problems occur with constant forces, gravity,springs and so on.Yes, it is true. However, any movement can be approximated as a sequence of linear movement steps (even if they are kept short), which make the problem much simpler by creating a simple pipeline:Physics solver [computes movement equation in absence of collision]|VLinearizer [Cuts the movement into linear steps]|VCollision detection [computes collisions between linear-moving objects];Quote:Original post by dawidjoubertI didnt bother to read it all cause it looks a bit squashed, but the theory atleast is.Yeah, it is a bit "squashed" but anyways, you managed to help me out, thanks!As for constant forces, I'll ignore them for now and hope they won't come back to haunt me later on - There's a limit to perfection and its burden to my progress.As for the second problem I stated earlier, if it does become a problem, I'll have to precalculate the amount of time the collision code will take to run.Thanks again,Ori   