I'm using getMesh to load a model to a mesh, but I'm not able to then change that model to another model using the same mesh.
Code: Select all
//Declaration
IAnimatedMesh* objectMesh;
ISceneNode* objectNode;
ITriangleSelector* objectSelector;
ISceneNodeAnimator* objectAnim;
// Loading model and stuff
objectMesh = smgr->getMesh("media/townhall.obj");
if (objectMesh)
{
objectNode = smgr->addOctreeSceneNode(objectMesh->getMesh(0));
}
if (objectNode)
{
objectNode->setPosition(vector3df(350,1,100));
objectSelector = smgr->createOctreeTriangleSelector(objectMesh->getMesh(0), objectNode, 128);
objectNode->setTriangleSelector(objectSelector);
}
if (objectSelector)
{
objectAnim = smgr->createCollisionResponseAnimator(objectSelector, camera, vector3df(30,50,30),vector3df(0,0,0),vector3df(0,10,0));
camera->addAnimator(objectAnim);
objectAnim->drop();
}
// Trying to change the model, fails
objectMesh = smgr->getMesh("media/townhall_unbuildable.obj");
Update: I tried setting the node to position (500,-5000,500) and then running addOctreeSceneNode again and that worked, but I got horrific FPS quite fast since I was stacking old models at position (500,-5000,500).