0
\$\begingroup\$

This question already has an answer here:

I'm writing a 3D rigid body physics engine, I am using OpenGl for simulation.

Only convex objects are considered.

My question involves how to detect the point of collision, so that when I apply a response force, I can also calculate torque.

I have used SAT algorithm to detect collision according to this reference,

Everything seems to be work fine , But as i get SAT only gives for objects are they colliding? as well as by how much?, it does NOT give you a reference point at which to apply the response force (and thus calculate torque).

I have looked at

Resource 1

Resource 2

Resource 1

None of them seems to be an answer

\$\endgroup\$

marked as duplicate by Theraot, Community Jun 26 at 14:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
\$\begingroup\$

In 2D rarely you have only one point of contact. I never played with collision resolution in 3D, but i guess this case will be even more rare.

As for the answer, take a look at Erin Catto's (creator of Box2D) GDC 2006 slides (GDC2006 Catto Erin Physics Tutorial). If i remembered it correctly, you should apply force (impulse) to all vertices of contact manifold. In 2D it is the overlapping part of two objects (some clipping allowed).

Use SAT to check if two objects are colliding. Then, select one face on one object as reference. Then, remove all points that are not inside the clipping planes (take the face and pull it up, along its normal vector - border of resulting figure is clipping plane). Then, remove all points that are outside of the reference object. Apply the response force to points that are left.

Erin Catto, GDC 2006

I really recommend looking at Box2D's source code. It's fairly easy to understand, and it's really well written and commented.

Ps. If you used only one point of contact, stacking boxes would be similar to stacking needles on each other... vertically.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your answer , I appreciate it \$\endgroup\$ – Abdulrahman Jun 26 at 14:30

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