Bounding box in animated scene nodes

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
darkmaster83
Posts: 24
Joined: Tue Oct 14, 2008 7:41 am

Post by darkmaster83 »

B@z wrote:

Code: Select all

IAnimatedMeshSceneNode* RepairBoundingBox(IAnimatedMeshSceneNode* node)
{
	IAnimatedMesh * mesh = node->getMesh();
		
	aabbox3df box;
	for (u32 i = 0; i < mesh->getMeshBufferCount(); i++)
	{
		mesh->getMesh(1)->getMeshBuffer(i)->recalculateBoundingBox();
		box.addInternalBox(mesh->getMesh(1)->getMeshBuffer(i)->getBoundingBox());
	}
	mesh->setBoundingBox(box);
	node->setMesh(mesh);
	return node;
}
dont know it helps, i used it for make the bounding box equal to the first frame's bounding box.
try it maybe it'll solve your problem
Thank you anyway. :)
I'm sorry, I try to use this function in the game loop, after movement by skeletal animation, but the rendering is too slow (only 2-3 FPS) and using:

Code: Select all

ode->setDebugDataVisible(EDS_BBOX);
I don't see the updating of bounding boxes after the movement...maybe it's a limit of the Irrlicht's actual version...but I don't want to think it, because an animation system that doesn't update bounding boxes is totally useless for almost all applications...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

It's a known problem, and is on the list for fixing before 1.5 is cut. I think Luke has been hijacked into meatspace though, so anyone else who wants to investigate it and suggest solutions would be very welcome.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

darkmaster83: nono, dont call it in loop.
just when you create your node.

Code: Select all

mynode = smgr->addAnimatedMeshSceneNode(....);
..
mynode = RepairBoundingBox(IAnimatedMeshSceneNode* node);
...
//and use it
it only changes the bbox to the same as the first frames bbox. thats all
Image
Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

SVN 1805 attempts to fix this. Feel free to let me know that it breaks all your apps.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply