I am presently trying to construct an OBB (Oriented Bounding Box) using the source and math contained in the book "Real Time Collision Detection".
One problem with the code contained in this book is that it does very little to explain what the parameters mean for the methods.
I am trying to figure out what I need to feed my setOBB() method (I wrote this one). It goes like this:
void PhysicalObject::setOBB( Ogre::Vector3 centrePoint, Ogre::Vector3 localAxes[3], Ogre::Vector3 positiveHalfwidthExtents )
{
// Ogre::Vector3 c; // OBB center point
// Ogre::Vector3 u[3]; // Local x-, y-, and z-axes (rotation matrix)
// Ogre::Vector3 e; // Positive halfwidth extents of OBB along each axis
m_obb.c = centrePoint;
m_obb.u[0] = localAxes[0];
m_obb.u[1] = localAxes[1];
m_obb.u[2] = localAxes[2];
m_obb.e = positiveHalfwidthExtents;
}
Looking at the parameters it wants above, the first and third parameters I believe I understand.
- Pass in the centre position of the object.
- This is my problem. I believe it wants a matrix represented using an array of 3 vectors? but how?
- A Vector which contains magnitude for the distance between the centre point and the edge of the OBB in each x,y,z direction.
Here is what I'm doing currently:
// Build the OBB
Ogre::Vector3 rotation[3];
Ogre::Vector3 centrePoint = sphere->getPosition();
rotation[0] = ?
rotation[1] = ?
rotation[2] = ?
Ogre::Vector3 halfEdgeLengths = Ogre::Vector3( 1,1,1 );
myObject->setOBB( centrepoint, rotation, halfEdgeLengths );
How can i represent a matrix using three vectors (which I cannot avoid doing this way). Thanks.