mnm23
17-08-2006 18:46:01
Hey guys. Im having a problem with the character class. Everything compiles fine. When i try to run the exe it crashes. The crash points to the character class in nxOgre saying there is nothing pointing there. It comes back with a NULL pointer at
mNode is 0 and owner is 0.
In my code i have it set up like this.
I call PlayerState in my LevelState like this.
I have used this style many times before and it works fine, but with recent events with nxOgre not liking the way i do things i thought it would be good to ask in here why this cant be done.
mNode = owner->mSceneMgr->getRootSceneNode()->createChildSceneNode(mName);
mNode is 0 and owner is 0.
In my code i have it set up like this.
PlayerState::PlayerState(nxOgre::character *mChar, Ogre::SceneManager *sm, Ogre::SceneNode *sn, char *name, char *meshName, Ogre::Vector3 size)
: mCharNode(mChar), mName(name)
{
mAb = 0;
//this->mCharNode = mChar;
GameInfo::getInstance()->addPlayer(name, this);
bp.setToDefault();
bp.setGravity(true);
bp.setSlopeLimit(45);
bp.setStep(0.5);
bp.setShapeAsCapsule(40, 150);
bp.setMesh("");
if(!mChar)
myNamespace::writeF("GameInit.log","no nxOgre Character");
if(!sm)
myNamespace::writeF("GameInit.log","no sceneManager");
this->mCharNode = bp.create("myCharacter", Ogre::Vector3(6000, 1000, -500), mScene);
this->mEntity = sm->createEntity(mName, meshName);
this->mEntity->setNormaliseNormals(true);
if(!sn)
{
this->mSceneNode = mChar->mNode->createChildSceneNode(mName);
}
else
{
this->mSceneNode = sn->createChildSceneNode(name);
}
this->mSceneNode->attachObject(mEntity);
this->mSceneNode->setScale(size);
}
I call PlayerState in my LevelState like this.
roman = new PlayerState(romanChar, mSceneMgr, romanNode, "Roman", "RomanBoss3.mesh", Vector3(1, 1, 1));
I have used this style many times before and it works fine, but with recent events with nxOgre not liking the way i do things i thought it would be good to ask in here why this cant be done.