Jump to content
  • Advertisement
Sign in to follow this  
manonoc

compute contact of OBB intersection

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've implemented the 15 tests of the separate axis theorem. That's ok. I've calculated too, the point where the contact is (computing the closest point): ( for each point of the other OBB: dot with the 3 unit vector of the axis of the OBB, clamp if greater than the box extents, and the closest point is the sum of the 3 dot products multiplied by the corresponding unit vector of the axis ) But I wonder about determining the normal of the contact: How to determinate which face of the OBB contain this point ? (determining too, if it is a vertex-face (the vertex is near 1 face), an edge-face(the vertex is near 2 faces), or a vertex-vertex (..3...) contact) - angle between center and this point - distance from the face, when computing which face is colliding thanks

Share this post


Link to post
Share on other sites
Advertisement
The contact point generation for two boxes works like this:

You test all potential separating axes and find the axis of minimum penetration. If this axis comes from a face you define this to be your reference face. Next you find the incident face to the reference face on the other shape and clip this against the *side* planes of the reference face. Finally keep contact points "below" the reference face. If the axis of minimum penetration is an edge combination you compute the closest points between the two edge segments.

An implementation of this can be found e.g. in the ODE. Look for dBoxBox here. You might also want to look into Erin Catto's presentation here (or look at the Box2D_Lite code): http://www.gphysics.com/files/GDC2007_ErinCatto.zip

These are two presentations. One deals with constraint solving and the other with contact point generation. It is in 2D, but the face cases can easily be translated to 3D. To get you started you can consider to ignore the edge cases first. For simple stacks or just a box that drops on a plane this is sufficient.

Share this post


Link to post
Share on other sites
based on something similar. The SAT will give you the normal of collision, as well as teh depth (for an intersection test).

With the normal, you find teh support points on the two boxes. could be a face, a vertex or an edge.

then you need to compute the 'intersection' between the two features (edge vs face, face vs face, vertex vs face, edge vs edge...), using common sense and a 3D clipping algorithm.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!