Jump to content
  • Advertisement
Sign in to follow this  
xiaowei

OBB again

This topic is 4007 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 there, im new here. I read a lot of threads about OBB here but i'm still confused about all this stuff. I've already implemented a vector and a matrix class. I can rotate and translate and so on. I want to implement an OBB. Let's say, i have a box with the Points A(3,3,0) B(5,3,0) C(5,5,0) and a center point T(4,4,4) When I googled for OBB i found that i also need an extension vector(?) What it is good for ? I can rotate these given points. my problems are - how to get the other points of this box - and how to check for collision. I've already read about the seperated axis test, but to speak truth,till now i dont understand it. ok i remember from school how to project a vector onto another vector, it was something with cosine. class BoundingBox { private: CVector3D m_vX; CVector3D m_vY; CVector3D m_vZ; CVector3D m_vCenter; public: void CreateBox(CVector3D& vX,CVector3D& vY,CVector3D& vZ,CVector3D& vCenter); void Translate(double dX, double dY, double dZ); void Rotate(double dArg, bool bX, bool bY, bool bZ) } can someone help me please ?maybe with a lil code snippet im despairing on that. please thanks xiaowei

Share this post


Link to post
Share on other sites
Advertisement
Hi there.

Usually an OBB is represented using a center point and three vectors representing
it's orientation and dimension and all of them are perpendicular to each other.
Think of it like a rotated coordinate system where the origin is the box's center.
These are the extension vectors.
For performing SAT(Separating Axis Theorem) there's lots of information on the web.
Clicky 1
Clicky 2

Cheers.

Share this post


Link to post
Share on other sites
Hello,
thanks for your fast reply.
U mean i have to do this:

Center - X = vector from centerpoint to first point
Center - Y = vector from centerpoint to second point
Center - Z = vector from centerpoint to third point

?

greetings,
Wei

Share this post


Link to post
Share on other sites
Not quite...

Like when you set your camera using look at camera
you have up,right,front to represent the camera orientation, the same goes for OBB.

Share this post


Link to post
Share on other sites
thanks again, but this dont helps me much. :(
I know, in OpenGl i can use the GLlookAt, then my camera looks at this
point. but this still helps me creating a obb.

Wei

Share this post


Link to post
Share on other sites
From what do you want the OBB to be created from?
If you have somthing like an enity that stores it's position and orientation,
it is just a matter of using this orientation and the dimensions of it's AABB to
construct the three extent vectors for the OBB.

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!