Thursday, October 27, 2016

How to separate colliding objects without creating more collisions


Suppose I use a simple discrete collision detection system where I move all objects then check for collisions. I want any colliding objects to be separated (of course) and assigned appropriate response velocities (bounce, slide, stop, etc.).


When I have a pair of colliding objects, how do I separate them without ending up with one or both of them colliding with other objects?



Answer




This is not an easy problem to solve in general. In a physics engine it would be handled by the contraint solver. There are many different types of constraint solvers, but one of the easiest to understand is a sequential impulse solver.


Erin Catto gave a nice explanation of a sequential impulse solver at several previous GDC's, they can be downloaded from the Box2D download page, see the GDC 2009 one for example.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...