Making a copy of IAnimatedSceneNode

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
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Making a copy of IAnimatedSceneNode

Post by bonsalty »

Hi!

Whats the proper way of making a copy from a mesh?

I made a custom object which is holding the model-node and the mesh.

Code: Select all

scene::IAnimatedMeshSceneNode *model;
scene::IAnimatedMesh* mesh ;
.
.
.
//init
mesh = params->smgr->getMesh(path.GetBuffer());
model = params->smgr->addAnimatedMeshSceneNode( mesh );

When I get the pointer of the mesh from the first object and call
model = params->smgr->addAnimatedMeshSceneNode( mesh );
for the second object, irrlicht gives an acces violation.

Any ideas?
Tomi
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Just look trough tutorials, there's a tutorial that loads 3 fairies with the same mesh.

What you should do I think:

Code: Select all

scene::IAnimatedMeshSceneNode *model;
scene::IAnimatedMeshSceneNode *model2;
scene::IAnimatedMesh* mesh ;
.
.
.
//init
mesh = params->smgr->getMesh(path.GetBuffer());
model = params->smgr->addAnimatedMeshSceneNode( mesh ); 
model2 = params->smgr->addAnimatedMeshSceneNode( mesh );
Working on game: Marrbles (Currently stopped).
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

you can use the clone() function...

Code: Select all

scene::IAnimatedMeshSceneNode *model;
scene::IAnimatedMeshSceneNode *model2;
scene::IAnimatedMesh* mesh ;
.
.
.
//init
mesh = params->smgr->getMesh(path.GetBuffer());
model = params->smgr->addAnimatedMeshSceneNode( mesh );
model2 = model->clone(); 
Post Reply