s0lidnuts
02-08-2008 21:52:46
When the object gets selected, I'm showing the ogre node's bounding box, and creating a cube shape on it's physics body so that future Raycasts won't miss through the robot's legs for example. Here is the code:
but the cube gets added on the half of the body, so I need to add it with an offset of the size of half of the body. How to do this offset?
Mesh Cube
I
I............I
I............I
.............I
Thanks.
//set current actor, creates cube shape for future raycasting, and show ogre's bounding box
m_CurrentActor = actor;
Ogre::SceneNode *node = m_SceneMgr->getSceneNode(actor->getName());
Ogre::AxisAlignedBox box = node->_getWorldAABB();
m_CurrentBBox = new NxOgre::Cube(box.getSize());
actor->addShape(dynamic_cast<NxOgre::Shape *>(m_CurrentBBox));
node->showBoundingBox(true);
but the cube gets added on the half of the body, so I need to add it with an offset of the size of half of the body. How to do this offset?
Mesh Cube
I
I............I
I............I
.............I
Thanks.