_getWorldAABB()

Problems building or running the engine, queries about how to use features etc.
Van
Hobgoblin
Posts: 512
Joined: Fri Nov 19, 2004 3:56 am

_getWorldAABB()

Post by Van »

I am having a problem with the _getWorldAABB() command as it pertains to a SceneNode.

I have a mesh that I KNOW is 3000Km in diameter (drawing in 3DS). I am NOT scaling the object.

I can do a SceneNode::showBoundingBox and this command works properly and draws a box around my SceneNodes.

However, when I attempt to get the bounding box from the SceneNode, it returns very small numbers (0.5000, 0.5000, 0.5000) and my boxes that I draw are extremely small.

What am I missing?

Code: Select all

	Ogre::Vector3 size;
	Ogre::AxisAlignedBox bbox;
	NewtonCollision* CollisionObj;

	// The following is used to get the objects size in the universe
	bbox = SB->Node->_getWorldAABB();	// Get the bounding box from Ogre
	size = bbox.getMaximum();			// Get the maximum extents of this box.

         CollisionObj = NewtonCreateBox(nWorld, size.x, size.y, size.z, NULL);

yes, I did look at the WireFrameBox code. I am blind as a damn bat because I can't see what I am doing wrong.

The size variable is not correct. Do I need to apply a scale to it? Is Ogre scaling without my knowledge? Does the camera's FOV have anything to with this (I do change the FOV)?
Van
Hobgoblin
Posts: 512
Joined: Fri Nov 19, 2004 3:56 am

Post by Van »

From my point of view _getWorldAABB() does not work. Is anyone else having a problem using this command to get the size of a node?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

_getWorldAABB is not guaranteed to give you the containment of all the objects in the node - it depends on how the SceneManager implements it. Note that it is an internal method, denoted by the preceding '_', and the docs say 'Recommended only if you are extending a SceneManager'.

The OctreeSceneManager does not deal with bounds using nested node bounds, it uses a completely different, octree-based structure. Therefore the nested AABBs are not even used by this manager, so you can't rely on them. All you can do is rely on the bounds of the objects themselves - the higher level structures are entirely dependent on how the SceneManager decides to treat them.
Van
Hobgoblin
Posts: 512
Joined: Fri Nov 19, 2004 3:56 am

Post by Van »

OK.

How do I get the bounds of a node? I need this information to construct a primitive collision mesh in my physics engine (Newton).

What command can give me the bounding data?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

Like I said in my last post, use the bounds of the objects attached to the node, not the node.
User avatar
Xypher
Gremlin
Posts: 180
Joined: Tue Jun 29, 2004 1:35 am
Location: Richmond, IN; USA

Post by Xypher »

Actually if you do a SceneNode->update(true, false) after you create the object and move all the child nodes around, it'll update the AABB and give you the correct size, which will be the size of the bounding box plus the padding, which is some obscure factor of the actual bounding box.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

It's not an obscure factor, you can adjust it in MeshManager::setBoundsPaddingFactor.