Page 1 of 1

removing a mesh from a node?

Posted: Sat Jun 12, 2004 12:00 am
by c_olin3404
Basicly what I'm trying to do is change weapons for my fps, I have an array of IAnimatedMesh* of the meshes of the weapons, and one node which is a child of the camera. In my change weapon function, i want to remove everything in the weapon node, and then add the correct mesh... but removeAll() makes the program freeze!! Why is this?

Posted: Sat Jun 12, 2004 12:51 am
by Tyn
Hmm, I'm not sure I understand the way you have it set up there, but this is what I would do.

I would create all the meshes on loading the level ( good practice, as there are no loading times then in the middle of a level for slow computers ) and then hide them all. Then, use your weapon switcher function to hide and unhide the meshes as needed. It probably isn't a good idea to delete meshes in the middle of the scene, it is all cleaned up in the end of the program with device->drop(), so just hide the unwanted meshes until then.

Posted: Sat Jun 12, 2004 6:04 am
by c_olin3404
but IAnimatedMesh as no ->setVisible() function, only ISceneNode does, and I need only a single node for the weapon!

Posted: Sat Jun 12, 2004 6:40 am
by brcolow
I looked up removeAll in the functions list, and it seems to only work for scene nodes. I believe it freezes because you are removing the node!

Posted: Sat Jun 12, 2004 7:51 am
by c_olin3404
I just changed it so that there is a seperate node for every weapon, and it works great... thanks!