Hey,
I have this 3rd person camera system kind of like WoW and just recently I drew a 3dbox around the terrain (to debug) and sometimes on startup the character is at the edge of the box even though his position is closer to the middle of the terrain.
Then at certain angles (when I rotate my camera) the bounding box jumps back to the right place, but then it jumps back to the wrong place if I keep rotating. What's going on?
I think irrlicht might be thinking my characters position is the origin at certain angles but I'm not sure why. Also, on some start ups the camera system and the bounding box work perfectly fine at all angles. Kind of weird. Any suggestions?
wierd problem with drawing 3d box around terrain
You are probably not setting the world transform before you render the bounding box. If you don't explicitly set the transform, the transform from the last rendered object will be used and that isn't going to be what you want most of the time. You should also be setting a material.
Code: Select all
// code assumes you have a scene node named 'terrain' and that
// i remember the names of all of the appropriate functions...
driver->setMaterial(video::SMaterial());
driver->setTransform(video::ETS_WORLD, terrain->getAbsoluteTransformation());
driver->draw3DBox(terrain->getBoundingBox(), video::SColor(255, 255, 0, 0));
perfect, that did the trick. I'm not sure what the material is for (probably not the same as the materials in Newton right? What's the difference?). I've tried to use the same implementation to draw a box around my animatedX mesh but I just can't seem to get it to appear around the node the mesh is attached to. ridiculous. Thanks for your help vitek