Release animatedCharacter crash

btx2397

21-02-2011 01:49:40

HI,betajaen when i create an Critter::AnimatedCharacter* mSinbad with interface createAnimatedCharacter is success,buf if i release the Pointer manual with interface destroyAnimatedCharacter the applications was crash .Is something i miss ? Here is my code.

/////=================================================================
mWorld = NxOgre::World::createWorld();
NxOgre::SceneDescription scene_desc;
scene_desc.mGravity = NxOgre::Constants::MEAN_EARTH_GRAVITY;
mScene = mWorld->createScene(scene_desc);
mRenderSystem = new Critter::RenderSystem(mScene, mSceneMgr);
mRenderSystem->createVisualDebugger();

// Fake Floor
BoxDescription fake_floor_desc(250,1,250);
fake_floor_desc.mGroup = Walls;
mScene->createSceneGeometry(fake_floor_desc, Vec3(0,-0.5,0));

// Setup Animations.
mRenderSystem->addAnimation("sinbad.mesh", SinbadLower, Critter::Enums::StockAnimationID_Idle, "IdleBase");
mRenderSystem->addAnimation("sinbad.mesh", SinbadUpper, Critter::Enums::StockAnimationID_Idle, "IdleTop");
mRenderSystem->addAnimation("sinbad.mesh", SinbadLower, Critter::Enums::StockAnimationID_Forward, "RunBase");
mRenderSystem->addAnimation("sinbad.mesh", SinbadUpper, Critter::Enums::StockAnimationID_Forward, "RunTop");
mRenderSystem->addAnimation("sinbad.mesh", SinbadLower, Critter::Enums::StockAnimationID_Jump, "JumpStart", 5.0, false);
mRenderSystem->addAnimation("sinbad.mesh", SinbadLower, Critter::Enums::StockAnimationID_Fall, "JumpLoop");
mRenderSystem->addAnimation("sinbad.mesh", SinbadLower, Critter::Enums::StockAnimationID_Land, "JumpEnd", 5.0, false);
mRenderSystem->addAnimation("sinbad.mesh", SinbadLower, 100, "Dance", 5.0, false);

Critter::AnimatedCharacterDescription desc;
desc.mShape = NxOgre::SimpleCapsule(5+0.5+0.1,2);
desc.mCollisionMask = (Walls << 1) | (Objects << 1);
desc.mMaxGroundSpeed = 17.0f;
desc.setJumpVelocityFromMaxHeight(mScene->getGravity().y, 0.75f);

mSinbad = mRenderSystem->createAnimatedCharacter(Ogre::Vector3(0,5,0), Ogre::Radian(0), "sinbad.mesh", desc);
mRenderSystem->destroyAnimatedCharacter(mSinbad); //crash at here.
//================================================================================================
i find when i use destroyCharacterController it will crash too.
my condition:
1.VS2008
2.Ogre 1.7
3.buggyswires
sorry for my bad english.

btx2397

21-02-2011 03:39:45

I find the answer in here
viewtopic.php?f=6&t=9444
debug mode will crash.
Release mode will Ok.

CiRiuS

22-02-2011 17:35:46

I have this problem too. destroyAnimatedCharacter crash for debug mode. :?

betajaen

22-02-2011 18:55:41

Can you trace it to the offending line?

CiRiuS

23-02-2011 04:08:40

Here is the trace that visual studio show me:

betajaen

23-02-2011 08:01:29

It's freeing a null pointer, hmm.

btx2397

28-02-2011 01:33:48

i find another qustion ,the capsule CC what i create with this shape paramer
<radius value="0.30136"/>
<lenght value="0.501601"/>
is above the terrain a litter bit .
here is the screenshot

CiRiuS

28-02-2011 18:35:53

I don't see the image but i think you refer to this:
viewtopic.php?f=6&t=14036

Regarding the crash, betajaen, are you trying to solve it?

btx2397

01-03-2011 03:23:50

i figure out 。it's SkinWidth make the postion higher .

CiRiuS

03-03-2011 14:45:54

Here is a hack thanks to my mate:

NxOgreShapeFunctions.cpp


Shape* createDirtyShape(NxShape* physx_shape, RigidBody* rigid_body)
{
Shape* shape = mFunctions[int(physx_shape->getType())] (physx_shape, true);
shape->setId(-1);
physx_shape->userData = 0;
return shape;
}


NxOgreRigidBody.cpp, inside RigidBody::_destroy()


for (vector_iterator<Shape*> shape = mShapes.elements(); shape != shape.end(); shape++)
{
void* userData = shape->getAbstractShape()->userData;
if ( userData )
{
PhysXPointer* shape_ptr = pointer_cast( userData );
GC::safe_delete(shape_ptr, NXOGRE_GC_THIS);
}
}


The userData pointer was not initialized.

betajaen

03-03-2011 15:16:20

Do'h. Cheers to your mate for finding out why.

I'll put it in the next commit.