IAnimatedMeshSceneNode::getBoundingBox not working

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
rakkar
Posts: 19
Joined: Sun Aug 07, 2005 11:24 pm

IAnimatedMeshSceneNode::getBoundingBox not working

Post by rakkar »

Updating to Irrlicht 1.5.1 with the RakNet Irrlicht demo, I found that the hit detection stopped working. It was due to this code:

Code: Select all

void CDemo::CalculateSyndeyBoundingBox(void)
{
	// Find the extents of the player character's model (for networking collision checks)
	scene::IAnimatedMesh* mesh = 0;
	scene::ISceneManager *sm = device->getSceneManager();
	mesh = sm->getMesh(IRRLICHT_MEDIA_PATH "sydney.md2");
	irr::scene::IAnimatedMeshSceneNode* model;
	model = sm->addAnimatedMeshSceneNode(mesh, 0);
	model->setScale(core::vector3df(2,2,2));
	core::aabbox3df modelBoundingBox = model->getBoundingBox();
	core::vector3df minEdgeExtended = modelBoundingBox.MinEdge;
	core::vector3df maxEdgeExtended = modelBoundingBox.MaxEdge;
The problem is that

Code: Select all

core::aabbox3df modelBoundingBox = model->getBoundingBox();
Is always returning a zero bounding box (zero on all values).

Was this a bug that was introduced, or is there something new I have to call?
rakkar
Posts: 19
Joined: Sun Aug 07, 2005 11:24 pm

Post by rakkar »

I found the problem

Code: Select all

// Bounding box changed in Irrlicht 1.5.1
	core::aabbox3df modelBoundingBox = model->getMesh()->getBoundingBox();
	// core::aabbox3df modelBoundingBox = model->getBoundingBox();
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

We have had a bug or two with the bounding boxes in 1.5. Didn't knew that it made it into 1.5.1. I'll check if the fix can be put into 1.5.2.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

Any news on this?
Latest trunk still suffers from the 0 box.
Here's a little test snippet.

Code: Select all

#include <irrlicht.h>

int main()
{
	irr::IrrlichtDevice* device = irr::createDevice(irr::video::EDT_NULL);
	irr::scene::ISceneManager* smgr = device->getSceneManager();

	irr::scene::IAnimatedMesh* sydneyMesh = smgr->getMesh("../../media/sydney.md2");
	irr::scene::IAnimatedMeshSceneNode* sydney = smgr->addAnimatedMeshSceneNode(sydneyMesh);
	sydney->updateAbsolutePosition();

	const irr::core::vector3df& extent = sydney->getTransformedBoundingBox().getExtent();
	const float bbHeight = extent.Y;
	const float bbWidth = extent.X;

	printf("H:%f W:%f\n", bbHeight, bbWidth);

	device->drop();

	return 0;
}
"Whoops..."
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Now, this mixes two things together. OP was a difference between mesh's bbox and mesh->getMesh()'s bbox. These are the same now. Other problem are differences between node's bbox and mesh's bbox. I couldn't find an empty bbox (but I also fixed the md2 init a little). But these bboxes are still different, don't know exactly why. BTW: Always test with 1.7 branch first, as this is the current one. trunk may be updated after some delay only.
Post Reply