4
\$\begingroup\$

I have two colliding boxes, How i can calculate contact information like (contact normal, contact point and penetration) .

Is there any simple algorithm .

Note: i'm using XNA .

\$\endgroup\$
8
  • \$\begingroup\$ what is this you should enter more information \$\endgroup\$ Commented Feb 1, 2012 at 21:15
  • \$\begingroup\$ Are you using a physics engine, or creating your own implementation? \$\endgroup\$ Commented Feb 1, 2012 at 23:18
  • \$\begingroup\$ I'm building physics engine \$\endgroup\$ Commented Feb 1, 2012 at 23:52
  • 1
    \$\begingroup\$ Are the two boxes axis aligned (ie - the borders are aligned to the x and y axis?), or can they be on an angle (ie, defined by four arbitrary points?)? \$\endgroup\$ Commented Feb 2, 2012 at 7:47
  • 2
    \$\begingroup\$ Google OBB (Oriented bounding boxes) algorithms if your boxes are arbitrarily aligned otherwise you can use AABB (Axis-aligned bounding boxes) algorithms. Also for extensive detail and algorithms I recommend the book "Real Time Collision Detection" by Christer Ericson. \$\endgroup\$ Commented Feb 2, 2012 at 15:49

2 Answers 2

1
\$\begingroup\$

I think this topic has been discussed a few times in the "Physics for Game Programmers" tutorial sessions at the Game Developers Conference.

This paper should at least give you some ideas: Contact Generation by Erwin Coumans.

There has definitely been at least one presentation by Erin Catto about how he does it in Box2d, but it's not clear whether the OP wants 2d or 3d. Anyway, his presentations are excellent and at least one of them (the 2008 one IIRC) mentions contact generation between two boxes via clipping: http://code.google.com/p/box2d/downloads/list

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

Maybe I'm not fully understanding your question, but if you're looking for general info on collision detection Microsoft has two MSDN pages available, one specifically for XNA:

Bounding Volumes and Collisions in XNA

Collision Detection Overview

You could also look at the Box2D physics engine to get more detailed info on the technical aspects.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I think it's just for Collision Detection and it does not return any collision information \$\endgroup\$ Commented Feb 3, 2012 at 19:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.