Re-initalizing a Scenenode[Solved]

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
Atraides
Posts: 18
Joined: Wed Jun 06, 2007 1:09 am
Location: Australia

Re-initalizing a Scenenode[Solved]

Post by Atraides »

Hi all,

May sound like a fairly dumb question but i was wondering if there was a way to re-initialize an AnimatedMeshSceneNode so i could change the mesh that it has.

For example.

I have 3 different type of weapons that the player can pick up. Each of these are their own .x files, however i want them all to appear at the same spot ergo i want them to all appear where the initial weapon was.

I was wondering if there was a better way than simple calling

bullet = smgr->addAnimatedMeshSceneNode(object.x);

as this seems to override the position,parenting, scaling that the other weapon had.

Thanks in advance.
Last edited by Atraides on Sun Jul 08, 2007 11:25 pm, edited 1 time in total.
Cheers
Courtney
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You need to keep, or get, a pointer to the IAnimatedMeshSceneNode. Once you have that you can call setMesh() to change the mesh.

Another option is to get a pointer to the old scene node, cache the position, orientation and scale, unload that scene node, create a new one and apply the cached values.

The final option would be to create a dummy scene node that has the transformation [position, rotation, scale] applied, and use that as the parent for the weapon. Then you just need to remove() the old weapon and add the new weapon as a child of the dummy node.

Travis
Atraides
Posts: 18
Joined: Wed Jun 06, 2007 1:09 am
Location: Australia

Post by Atraides »

ah sweet i knew it would be something straight forward.

thanks vitek.
Cheers
Courtney
Post Reply