IAnimatedMesh : is it possible to update a bounding box ?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Oddmonger
Posts: 24
Joined: Tue Oct 04, 2005 7:01 pm
Location: Near Paris

IAnimatedMesh : is it possible to update a bounding box ?

Post by Oddmonger »

Hello.

As a little drawing say more than lot of words, let's look at this:

Image

How ugly.

It would be nice if IAnimatedMesh could update the bounding box while the animation is running.

Is it possible ? Or may i have to do it myself ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Some animated mesh do that, e.g. md2. So I don't understand why yours doesn't :?
Oddmonger
Posts: 24
Joined: Tue Oct 04, 2005 7:01 pm
Location: Near Paris

Post by Oddmonger »

hybrid wrote:Some animated mesh do that, e.g. md2. So I don't understand why yours doesn't :?
Hmm well, i don't understand either

The nice running woman on the screenshot is "sydney.md2" and comes from the "media" directory of Irrlicht.

So the bounding box should grow when Sydney is running, should'nt it?

I'll give a closer look tomorrow. On the samples, not on Sydney :wink:
Oddmonger
Posts: 24
Joined: Tue Oct 04, 2005 7:01 pm
Location: Near Paris

bounding box aren't updated in md2 animation cycle

Post by Oddmonger »

Ok, i've modified a bit the first sample of Irrlicht sample dir.
I've added bounding box visibility.
You can see that the bounding box doesn't change while Sydney is running.

Here is the complete code for testing:

Code: Select all

/* based on irrlicht sample: 01.HelloWorld 
   i've stripped all i could, to only keep the bare minimum for running.
   i've added the bounding box visibility.
*/

#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;

int main()
{
  IrrlichtDevice *device =
     createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16, false, false, false, 0);

  device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");

  IVideoDriver* driver = device->getVideoDriver();
  ISceneManager* smgr = device->getSceneManager();

  IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
  IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

  //show me the bounding box, Lebowski!
  node->setDebugDataVisible(EDS_BBOX);

  if (node)
  {
    node->setMaterialFlag(EMF_LIGHTING, false);
    node->setMD2Animation ( scene::EMAT_RUN );
  }

  smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

  while(device->run())
  {
    driver->beginScene(true, true, SColor(255,100,101,140));
    smgr->drawAll();
    driver->endScene();
  }

  device->drop();
  return 0;
}
Post Reply