# Dealing with collision inaccuracies

This topic is 3813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

What is the best way to avoid/handle objects that intersect each other after a collision? My game uses a triangle<->triangle collision system (3d) and does this by 1) testing one polygon's vertices against another's surface and 2) by testing one's edges against the other's edges (for edges that lay between two triangles forming an outer corner). All collisions are in fact detected, but now and then (because I try to calculate the exact moment of impact) a vertex or edge might end up slightly behind another polygon. This especially happens when two rotating objects hit. Now I'm not sure if I should force/displace intersecting objects the shortest way out or allow the object to stay inside as long as it doesn't move further in. My problem with the first method is that I might actually move an object out but move it right back in another causing the game to get stuck in an endless loop of shuffling objects around. The second method seems better to me, but I have no clear idea of how to implement this. If say a cube (A) lands on the corner of another cube (B) and intersects, A should be able to skim freely across B's top surface because A's blue edge doesn't move further into B2. But A's orange edge also crosses B1 and moving A to the right would make the object move in (from B1's point of view). Since it's actually a 3d problem even more edges intersect. I would probably have to do a lot of extra tests to see if moving an object inwards relative to one surface actually doesn't move the object in compared to the entire object, so this might also kill the app's performance.

##### Share on other sites
the easy method is that when you discover that an object has moved and is now intersecting another, to interpolate the current position with the last one. do a binary search starting at T(0.5), until the objects are just touching, then recalculate the amount of energy the faster of the two objects has. Configure the engine to ignore tiny interpolations so that you dont go into too many iterations of the binary search.

For added accuracy but added complexity, you can do this to BOTH objects. Entire papers have been written on ways to speed up the process, and of course complete alternatives to the method.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633680
• Total Posts
3013304
×