3
\$\begingroup\$

I am working on a project in which I have implemented the Separating Axis Theorem to detect collisions between objects. My current collision response is an object that contains whether it is overlapping and what the minimum translation vector (MTV) is.

I then take the MTV and add it to the linear velocity of the object we're testing. This all works fine. However, I want to add rotational forces to the object based on the collision. For this, I imagine we will need two things:

  • The Minimum Translation Vector, which represents the force
  • A contact point, which is the point at which the MTV-force gets applied to the object

However, I have been struggling with calculating the contact point for the past two/three days. I haven't been able to find good resources on this, unfortunately.

How would I go about calculating a suitable collision response as I described? Thank you very much!

\$\endgroup\$
1
\$\begingroup\$

I will assume this question is about 3D SAT which I find has alot less resources than 2D..

I have been struggling with this for the past week. I have face contacts down but not Edge cases.

When you are testing your various axes keep track of which has the minimum overlap, that is your contact normal and penetration depth.

Contact points are where it gets interesting, depending on how you have the Axes to test setup you can determine what type of collision has occured (i.e Face to Vertex, Edge to Edge).

When you are testing the face normals of Object A and Object B and one of them happen to be the axis with the minimum depth penetration, that is a Face contact. If it is one of the edge pairs axes that has the minimum depth penetration, it is an Edge contact.

To find the Contact point for a Face contact I used an algorithm that tests if a point is inside a cube (which is easier than it sounds if you have the dimensions of a cube on hand). The algorithm is as follows:

  1. Calculate the vector from a worldspace vertex of Object A to the center position (should also be worldspace) of Object B.

  2. if the Dot product of that Vector with 3 Face Normals of Object B is within the range of the size of the Object B, then that vertex is inside of B and thus is a contact point.

  3. Loop through the rest of the verticies of Object A.

I recommend you do the same algorithm for Object B since there can be contact points from both objects in some situations. (Also this algorithm can be optimized, meaning you dont have to test all 8 verticies of a Cube but I'll leave that for you cause I'm still ironing that out lol.)

When it comes to the actual collision response, theres even less resources out there on that I find. I recommend looking at Ian Millington Game Physics Book edition 2 for his flavor of collision response.

I hope this helps in anyway! P.S if anyone knows how to do edge cases let me know, That is a battle im currently undergoing.

edit: wow this was asked 4 years ago. Well I hope you found a solution before this.

| improve this answer | |
\$\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.