srysry
28-07-2008 13:12:58
Hi, i'm currently working on this survival game project and i'm having a error when the physics engine call my collision call back functions.
Atm, i'm trying to push my character up into the air when it hits into a tornado actor.
I call the code in my level initializing
reporter is a *pointer variable in my AppStateGame class
The error breaks with this error code appearing in my call stack:
in the header file nxogrecharactercontroller.
Does any have a solution to this? I have read up most of the CharacterHitReport but no one doesnt seem to have any error in the initializing part. Any help is greatly appreciated. Thanks!
Atm, i'm trying to push my character up into the air when it hits into a tornado actor.
//this is my callback class
class CPlayerHitReporter : public NxOgre::CharacterHitReport
{
public:
NxOgre::CharacterHitReport::Response onActor(NxOgre::Character * c, NxOgre::Actor *actor, NxOgre::ActorGroup *actorGrp)
{
//code to push character up into air
return RS_Push;
}
};
I call the code in my level initializing
void AppStateGame::OnEnter (AppStateBase *previousState)//INIT OF GAME STATE
{
//INIT Player Model and Data
SceneManager * sceneManager = Application::mSceneMgr;
mLevel->SetupPhysics();
//create character
//INIT Player Model and Data
NxOgre::CharacterParams Params;
Params.setToDefault();
Params.mType = NxOgre::CharacterParams::CT_Capsule;
mPlayer = new Character();
mPlayer->mChar = mLevel->mScene->createCharacter("ninja",NxOgre::Pose(Vector3(0,1,0),Ogre::Quaternion::IDENTITY),Params);
mPlayer->mChar->attachMesh("ninja.mesh");
mPlayer->mChar->createNode();
mPlayer->mChar->getNode()->scale(0.2,0.2,0.2);
mPlayer->mChar->getNxController()->setCollision(true);
mPlayer->animState = mPlayer->mChar->getEntity()->getAnimationState ("Walk");
mPlayer->AttackState = mPlayer->mChar->getEntity()->getAnimationState ("Attack3");
//Initialize All Players Animation States
if (mPlayer->animState)
{
mPlayer->animState->setEnabled (true);
mPlayer->animState->setLoop (true);
}
////////////////////INITIALIZING GAME ENVIRONMENT///////////////////////
//initializing skybox
sceneManager->setSkyBox(true, "Skybox", 250, true);
//COMMENT THESE LINE TO CHECK FOR ERRORS(BIRD EYE VIEW OF GAME)
//Init Stage Camera
Ogre::Camera * mCamera = sceneManager->getCamera("PlayerCam");
mCamera->setPosition(mPlayer->mChar->getNode()->getPosition()
+ Vector3(0,35,-5));
mCamera->setFarClipDistance(750);
mPlayer->mChar->getNode()->attachObject(mCamera);
//Init Stage Floor
mLevel->NewLevel(true);
///////////FINISH INITIALIZING GAME ENVIRONMENT////////////////
// set debug text
mLevel->mWorld->getCharacterController()->addHitReport(mReporter);
OverlayManager & overlayManager = OverlayManager::getSingleton ();
OverlayElement * overlay = overlayManager.getOverlayElement ("DebugTestOverlay");
overlay->setCaption ("In State: Game. Press F5 to go into End state or F8 to go back to main menu or F12 to restart level.");
}
reporter is a *pointer variable in my AppStateGame class
The error breaks with this error code appearing in my call stack:
NxOgre_d.dll!NxOgre::CharacterController::onShapeHit(const NxControllerShapeHit & hit={...}) Line 172 + 0x2c bytes C++
in the header file nxogrecharactercontroller.
Does any have a solution to this? I have read up most of the CharacterHitReport but no one doesnt seem to have any error in the initializing part. Any help is greatly appreciated. Thanks!