Strange bug when deleting objects

rpgplayerrobin

28-02-2010 02:11:09

Hey,

In my scene, I can create objects whenever I want (boxes), and I can also delete objects whenever I want like this:

How I create the object:

OGRE3DBody* tmpDynamicObjectBody = m_renderSystem->createBody( NxOgre::BoxDescription( size.x, size.y, size.z ),
NxOgre::Vec3( position.x, position.y, position.z ),
meshName + ".mesh" );



How I delete the object

m_renderSystem->destroyBody( dynamicObject->m_ogre3DBody );
app->m_SceneMgr->destroyEntity( dynamicObject->m_entity );


When I use this code and I create several boxes and then delete a random box (one which is not the first one I created), it seems that both the first box I created and the box I actually want to destroy are both destroyed. If I delete the first box I created only, that is the only one that is destroyed.
Anyone else experience this or know the answer to why it is happening?

I am using NxOgre 1.6.0 Detritus, just so you know.

Thanks in advance!

// Robin

EDIT: Is there a possibility that OGRE3DBody's can be shared? Because if I just destroy the body of an object and not the entity (which is not the first one I created), the first one I created is the only one which is removed...