destroyBody crash, wind question

Riyunoa

31-01-2007 15:37:17

All I did was, when two dynamic bodies collide...


if ( mScene->findBody( mBody->getName() ) )
{
mScene->destroyBody( mBody->getName() );
}


It dies at this point:


Is there something I'm doing wrong?

And regarding wind - I've tried setWind(100,0,100), and setWind(1,0,1) but neither has any visible effect even though I've addState( nxOgre::STATE_EFFECTEDBY_WIND )'d the dynamic bodies. What else do I need to activate wind?

betajaen

31-01-2007 15:50:17

Shouldn't be. Can I see your setup and deletion body code?

Wind isn't really implemented, infact I may remove it from the scene class and move it to another part of NxOgre. Wind itself is just a force, so it shouldn't be to hard for you to come up with something. ;)

Riyunoa

31-01-2007 16:26:05

Yep, I guessed as much, that the error shouldn't happen.

Setup code:
void PowerUp::Create ( std::string bodyname, std::string meshFileName, Vector3 &pos, Vector3 &scalevalue, Vector3 &axis, Radian &rotation )
{
mBody = mScene->createBody( bodyname,
meshFileName,
new nxOgre::cubeShape ( 10.0f ),
0.00785,
pos );


I have a factory for this, that assigns it a name in a running order.

The deletion code was just that,

if ( mScene->findBody( mBody->getName() ) ) //this returned 1 when I ran the code
{
mScene->destroyBody( mBody->getName() ); //the line that I added that caused the crash
}


Sorry for being a n00b. :oops:

And as for the wind - Yep, I had initially come up with something but I was like "Whoo!! An auto-wind thingy!! :o"