NxOgre reinitialisation

Pottej

21-06-2007 17:07:27

Hi,

In our game we needed to completely shut down the nxogre world and reinitialise it, but found out that we got errors when trying to do this.

To shut down we used:


mScene->destroyCharacter("whatever"); // not my actual character destruction
delete mScene;
delete mWorld;


Then later I remake:


mWorld = new NxOgre::World("FrameListener: No");


Which throws an exception at runtime. I found that the exception came because although the NxOgre::Error class is shut down, the singleton pointer is never deleted. Therefore to make a new world we added the line:


mError = 0;


in Error::~Error(), so when the class is shut down the singleton pointer is reset to 0 too. This has fixed all our problems and we can now delete and remake physics worlds without errors.

I just thought I better post this here in case it is causing anyone else problems. :)

Pottej

betajaen

21-06-2007 18:06:44

Your not supposed to do that, World is practically a singleton.

Just delete all of the Scenes and start afresh.

Pottej

21-06-2007 20:06:38

k cheers, was just neater in our app if we could delete the world too since it isnt needed everywhere. Maybe we'll change it again.

betajaen

21-06-2007 20:15:10

It's the same as deleting Ogre's Root, which we all don't do.

Besides I don't know what the long term effects are of deleting the PhysicSDK singleton and creating them are. Especially with PhysX hardware.