0
\$\begingroup\$

I am currently trying to develop a small physics engine for my games. I have created bounding volumes for different rigid bodies. However, I am having problems handling collision resolution, more specifically with determining the direction to apply the impulse to the objects and their changes in velocities.

How do I perform collision resolution for rigid bodies of varying volume? Is there a general solution for resolving collision between all rigid bodies like sphere, AABB or OBB, or do I have to specifically arrive at a solution for each scenario?

\$\endgroup\$
0
\$\begingroup\$

You need to isolate your CollisionDetector and your CollisionResolver. The CollisionDetector must return data from the collision, i.e collision point, normal collision, interpenetration, etc.

Then you need pass this information to CollisionResolver and it must solve the collision with the information provided. In this step the rigidbody shape (AABB, OBB, sphere, etc) is irrelevant. You only need to find the impulse to apply, divide it into linear and angular component and apply it to the collision point (calculated previously in the CollisionDetector)

You can see a very simple example here: http://angelluispg.es/AL3D/ALPhysics.js

This is a very simple physics engine programmed by me that doesn't take in account angular movement, but you can see the general idea. The important parts for you problem is the class ALPhysics.NarrowPhase and the class ALPhysics.CollisionResolver

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.