Issues with bounding Boxes
Issues with bounding Boxes
Hi, I already searched the forum but wasn't able to find a suitable answer:
When i use the boundingBox->getCenter() of a bounding box of a mesh,
I get strange results. The mesh is a simple circle. For indicating the center of the bounding box i set a billboard to the position returned by getCenter(), however its not in the middle of the circle but below it and not centered.
I tried to set the target of the camera to check if this is billboard specific but i got the same results : it pointed to a wrong position.
Can somebody help me?
When i use the boundingBox->getCenter() of a bounding box of a mesh,
I get strange results. The mesh is a simple circle. For indicating the center of the bounding box i set a billboard to the position returned by getCenter(), however its not in the middle of the circle but below it and not centered.
I tried to set the target of the camera to check if this is billboard specific but i got the same results : it pointed to a wrong position.
Can somebody help me?
-
- Posts: 78
- Joined: Sat May 27, 2006 9:24 pm
- Location: Logan, UT
Well since you searched the forums, you probably saw alot of people having issues with bounding boxe. I myself have never been able to get them to translate properly. They warp, and go completely off of where they should be, since I'm assuming you tested this by displaying the bounding boxes, you know this as well.
I remember seeing somewhere that hybrid had them working better, but they still don't work right.
I've come to completely ignore them as anything useful in Irrlicht until they're working 98% correctly.
On the other hand, you can use Newton for all of this and it works 98% correctly already.
I remember seeing somewhere that hybrid had them working better, but they still don't work right.
I've come to completely ignore them as anything useful in Irrlicht until they're working 98% correctly.
On the other hand, you can use Newton for all of this and it works 98% correctly already.
Stout Beer
-
- Posts: 78
- Joined: Sat May 27, 2006 9:24 pm
- Location: Logan, UT
mmm.. Quick to jump on it hybrid eh?? I've only used Irrlicht 1.0 and have never had the bounding boxes work right after moving the node around, and using the get transformed bounding box method.
will setup a test right now and run it.
Hm. Well, thats not so horrible ?? What was my problem before.. So the getCenter should work right, but obviously, the bounding boxes still need some work Hybrid, these are static meshes.
When you use GetCenter() you should use it on the transformed bounding box, are you doing that?
It would be like this:
Otherwise, I can see how the center wouldn't line up.
will setup a test right now and run it.
Hm. Well, thats not so horrible ?? What was my problem before.. So the getCenter should work right, but obviously, the bounding boxes still need some work Hybrid, these are static meshes.
When you use GetCenter() you should use it on the transformed bounding box, are you doing that?
It would be like this:
Code: Select all
irr::core::aabbox3d<f32> box = Node->getTransformedBoundingBox();
vector3d<f32> center = box.getCenter();
Stout Beer
-
- Posts: 78
- Joined: Sat May 27, 2006 9:24 pm
- Location: Logan, UT
Wow. I was about to get really really pissed off. Before, when I tried debugdatavisible, it always crashed, leaving me to believe it was not implemented in alot of scene nodes. But now, for some fee'd up reason its absolutely working correctly.
But also, does this mean when you want to get a useful aabbox you must use the world transform on it? Because I have not seen that explained anywhere that it must be done - Although, I have seen it done before without any explanation as to why.
Also I still think debugdatavisible isn't implemented in alot of nodes. Am I wrong?
But also, does this mean when you want to get a useful aabbox you must use the world transform on it? Because I have not seen that explained anywhere that it must be done - Although, I have seen it done before without any explanation as to why.
Also I still think debugdatavisible isn't implemented in alot of nodes. Am I wrong?
Stout Beer
Yeah, the debug data is only enabled for some scene nodes.
All bounding boxes are useful, you just need to know which coordinate space they are in. If you are going to render a box, you need to set the appropriate world matrix before you render it, otherwise you'll get some weird results.
The following snips of code would draw the bounding box for a scene node. You will see a different bounding box depending on which one you use.
Travis
All bounding boxes are useful, you just need to know which coordinate space they are in. If you are going to render a box, you need to set the appropriate world matrix before you render it, otherwise you'll get some weird results.
The following snips of code would draw the bounding box for a scene node. You will see a different bounding box depending on which one you use.
Code: Select all
Driver->setMaterial(video::SMaterial());
// box is in world coordinates, so local to world transform is identity matrix
Device->setTransform(video::ETS_WORLD, core::matrix());
Driver->draw3DBox(node->getTransformedBoundingBox(), video::SColor(255, 0, 192, 192));
Code: Select all
Driver->setMaterial(video::SMaterial());
// box is in object coordinates, so we must apply local to world transform
Driver->setTransform(video::ETS_WORLD, node->getAbsoluteTransformation());
Driver->draw3DBox(node->getBoundingBox(), video::SColor(255, 0, 192, 192));
Last edited by vitek on Sun Nov 19, 2006 3:50 pm, edited 1 time in total.
-
- Posts: 78
- Joined: Sat May 27, 2006 9:24 pm
- Location: Logan, UT
-
- Posts: 78
- Joined: Sat May 27, 2006 9:24 pm
- Location: Logan, UT