sepherith
24-03-2008 20:09:16
Hi to all.
first of all excuse me for my english.
I'm adding physic ti my basci project but i have a problem similar to this http://www.ogre3d.org/phpBB2addons/view ... +direction
i have searched in the forum for ideas but i have found nothing.
my character continue to move in wrong direction (if i press up it goes to left, ans so on...)
I have tried with model orientation, changing model, rotate node and character.. but nothing....
this is my code
My movement
a part of my controller
my main character
first of all excuse me for my english.
I'm adding physic ti my basci project but i have a problem similar to this http://www.ogre3d.org/phpBB2addons/view ... +direction
i have searched in the forum for ideas but i have found nothing.
my character continue to move in wrong direction (if i press up it goes to left, ans so on...)
I have tried with model orientation, changing model, rotate node and character.. but nothing....
this is my code
My movement
class MM_MainChar_Movement : public NxOgre::CharacterMovementVectorController
{
public:
void move(NxVec3 &out, NxVec3 &moveVector, NxQuat &direction, NxVec3 &g, float t, NxOgre::Character* )
{
NxReal mySpeed = 50;
out = ((direction.rot(moveVector) * mySpeed) + g) * t;
}
};
a part of my controller
if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)){
//transVector.z += mMove;
mPlayerCharacter->addMovement(Character::DR_Forward);
sAnime="walk";
}
if (mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)){
mPlayerCharacter->addMovement(Character::DR_Backward);
}
my main character
mMainCharacter = mpScene->createCharacter("Character",Vector3(x,y,z),"");
mMainCharacter->attachMesh(MainChar+".mesh");
mMainCharacter->setMovementVectorController(new MM_MainChar_Movement());
SceneNode* mCameNode = mMainCharacter->getNode()->createChildSceneNode("MainCameraNode");
SceneNode* mPitcNode = mCameNode->createChildSceneNode("PitchCameraNode");
//mMainCharacter->setDirection(Degree(90));
//mCameNode->rotate(Vector3(0,1,0),Degree(90));
mCamera->setPosition(x,y+7,z);
mPitcNode->attachObject(mCamera);
mPitcNode->setPosition(x,y,z-20);
mCamera->lookAt(x,y,z);
mCameNode->setAutoTracking (true, mMainCharacter->getNode());
mCameNode->setFixedYawAxis (true);
mCamera->setNearClipDistance(5);
mCamera->setFarClipDistance(800);