Node and mesh

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Node and mesh

Post by cyberbobjr »

Hi !
A really complex problem :(
Probably, Niko already know that :)

It seems that when you drop or remove a IAnimatedSceneNode, it suppress the mesh associed to, for example, this is my code :

Code: Select all

IPlayer::attachObjectCamera(IEntity *objectToAttach)
{
// On définit la position de l'objet par rapport à la camera
core::vector3df posWeaponCam(10,-15,15);
// Si il y'a déja un objet attaché à la camera, on le supprime
if (nodeObjectCamera!=NULL)
	nodeObjectCamera->drop();
// Création du node attaché à la camera
nodeObjectCamera = smgr->addAnimatedMeshSceneNode(objectToAttach->getMesh(),smgr->getActiveCamera(),0,posWeaponCam);
// On définit les paramêtres textures
nodeObjectCamera->setMaterialFlag(video::EMF_LIGHTING, false);
nodeObjectCamera->setMaterialTexture(0,objectToAttach->getMaterial());
};
This function is for create a weapon attached to the camera.
the IEntity class is a base class for all my object in the world, it have a function getMesh() which return a IAnimatedMesh class.
Althought, when this function more than 2 times, an error occur = the mesh in objectToAttach disappear.

I'm wonder if :
when you drop a node, the mesh linked with the node is dropped too ?

Thanks for your help !
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

No, the mesh should still be in there. In fact, it is stored by the Scenemanager, and exists as long as the scene manager does.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Okay,
Thanks, i've find my mistake : my linked list :)
Post Reply