crash at closing of application

jchmack

14-08-2007 12:26:48

after I'm done with my app and i close it i get this from ogre:

06:06:23: OGRE EXCEPTION(5:ItemIdentityException): MovableObjectFactory of type Camera does not exist in Root::getMovableObjectFactory at ..\src\OgreRoot.cpp (line 1082)

it started happening after i upgraded to a newer version of NXOgre i haven't changed anything in "my" code and am really confused. I think i might be deleting a camera incorrectly or something. I have cameras attached to the nodes of characters and i believe that when i delete the character i get the crash.

but i have these in my dtor:


GameCharacter::~GameCharacter()
{
GetNode()->detachObject(FirstPersonCamera);
ThirdPersonPivotNode->detachObject(ThirdPersonCamera);
}

betajaen

14-08-2007 12:44:03

It's a bug with NxOgre. You have cameras attached to the bodies, which they get deleted when the bodies do. I've fixed this in '34, by moving all non-entities to the RootSceneNode.

This is the Body Destructor in '34


Body::~Body() {

if (mNode == 0)
return;


Ogre::SceneNode::ObjectIterator object_it = mNode->getAttachedObjectIterator();
Ogre::MovableObject *m;
while(object_it.hasMoreElements()) {
m = object_it.getNext();
if (m->getMovableType() == "Entity") {
mOwner->getSceneManager()->destroyEntity((Ogre::Entity*) m);
}
else {
mNode->detachObject(m);
mOwner->getSceneManager()->getRootSceneNode()->attachObject(m);
}
}

mNode->detachAllObjects();
mNode->removeAndDestroyAllChildren();

if (mNode)
mOwner->getSceneManager()->destroySceneNode(mNode->getName());


}


Replace your copy with that.

[Edit]

For some reason the above code is in '33. I suspect it is related to the cameras being moved then.

jchmack

14-08-2007 12:48:45

well i have cameras attached to the character class not the body class could you please post the dtor to the character class?

as for the moving of the objects all i do is attach it to the node you create then move around the character:

SceneNode* GetNode(){return mCharacter->getNode();}

//first person camera
FirstPersonCamera = mScene->getSceneManager()->createCamera(name+"FirstPersonCamera");
FirstPersonCamera->setNearClipDistance(0.1);
FirstPersonCamera->moveRelative(Vector3(0,(CharacterHeight/2),-CharacterRadius));
GetNode()->attachObject(FirstPersonCamera);

//third person camera
ThirdPersonPivotNode = GetNode()->createChildSceneNode(name+"ThirdPersonPivotNode");
ThirdPersonEndNode = ThirdPersonPivotNode->createChildSceneNode(name+"ThirdPersonEndNode");
ThirdPersonCamera = mScene->getSceneManager()->createCamera(name+"ThirdPersonCamera");
ThirdPersonCamera->setNearClipDistance(0.1);

ThirdPersonPivotNode->attachObject(ThirdPersonCamera);
ThirdPersonPivotNode->setPosition(Vector3(0,1.5,0));
ThirdPersonPivotNode->pitch(Ogre::Degree(-30));
ThirdPersonEndNode->setPosition(Vector3(0,0,10));
ThirdPersonCamera->moveRelative(Vector3(0,0,10));

betajaen

14-08-2007 16:47:19

Ahhh. That makes more sense then. No I haven't got anything in the character class does that, which I shall put in.

So for now you should move the Cameras out of the Character Node before shutting down.