Characters within Frame Listeners

Plague

28-11-2007 04:22:51


CharacterController* mCharacterController;
Character* mPlayer;
mPlayer = mCharacterController->get("BlueTank.mesh");

bool frameStarted(const FrameEvent &evt)
{
if(mMouse)
mMouse->capture();
if(mKeyboard)
mKeyboard->capture();
mPlayer->getNxController()->getActor()->addLocalForce(toNxVec3(mDirection), NxForceMode::NX_SMOOTH_VELOCITY_CHANGE);
return mContinue;
}


I'm running the above code from an overridden version of Ogre's FrameListener class. The code compiles cleanly, but when I run the code I get a nasty sticky runtime error.

Unhandled exception at 0x00403bfe in PhysicsTest.exe: 0xC0000005: Access violation reading location 0x00000024.

I'm rather a noob to runtime debugging, and I was wondering how I would go about fixing this.

Is it a bad idea to try and change an NxOgre Character from within an ogre frame listener? Or am I just calling something wrong?

betajaen

28-11-2007 09:25:38

Apart from adding that force to a player will do diddly squat.

I'd say that error is due to Player/NxController/Actor being a null pointer, I'm guessing Player.