0
\$\begingroup\$

(Edited, was a rather goofy, long question. I have since decided on using JBullet and I love it.)

How can I accomplish 3D OBB vs OBB collision detection in my game? I understand how AABB's detect being inside one another, and I understand how to rotate a point around another point. But once a collision is detected, how should a physics engine respond to that? It is the collision and resolution that I don't understand how to do; making the objects move/react appropriately.

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

There are many ways to perform collision detection Cello Coder. The simplest may not be the best solution for your game and may cause bugs to show up...

I have never used LWJGL so there might be a library someone has made for collisions, but it really comes down to two ways.

  1. easy way - buggy - perform a check to see if the mesh of object one is near object two pseudocode -> obj1.pos +/- obj1.size intersects a bound that obj2.pos+/- obj2.size also intersects.

  2. harder way - less buggy - calculate the velocity of the moving obstacles at each time there is an interaction and check to see if the two velocities(of the objects) intersect. If they do intersect calculate the time of intersection and set a condition to make those two objects interact accordingly.

If you are worried that 3D is a little bit different than 2D, just think of it as adding the third dimension and performing the math the same way, but adding in a third variable into the equation.

Does that make sense?

\$\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.