How general games solve this question?So difficult.
ODE作的是刚体动力学,似乎不适合作解决方案.
1.The easiest way to handle a collision is to simply stop and not allow the move when a collision is detected. On the other hand - that is not how the professionals do is it? No, we want fancy collision response like sliding along the walls, automatically climbing stairs and automatically bumping over smaller obstacles on the ground.
2.The penetration depth of a pair of intersecting objects is the shortest vector over which one object needs to be translated in order to bring the pair in touching contact.
3.Responses are managed in response tables. To each object on which a response is defined in a response table a response class is assigned. Responses are defined per pair of response classes, rather than per pair of objects. So, the response for a pair of objects is the response defined for their respective response classes.
1.Move our sphere as close as possible to the triangle we’re colliding with.
Lets call this position for “newPosition”.
2. Calculate the sliding plane based on this new position.
3. Project the original velocity vector to the sliding plane to get a new
destination.
4.Make a new velocity vector by subtracting the polygon intersection
point from the new destination point.
5.Recursively call the entire collision detection routine with the new position
and the new velocity vector.Reference:
http://www.peroxide.dk/download/tutorials/tut10/pxdtut10.htmlhttp://www.win.tue.nl/~gino/solid/gdc2001depth.pdfhttp://www.gamasutra.com/features/20000330/bobic_01.htmhttp://people.netfarm.it/~guyver1/Didattica/RTM/Lezioni/Lezione6/CollisionDetection_file/frame.html#slide0067.html