spacegaier
08-03-2008 21:31:55
Another problem:
I've got a character, which I want to move. In fact he does, but in the wrong directions.
MyMovement class:
Assigning it to my character:
And here the movements are added:
I've got a character, which I want to move. In fact he does, but in the wrong directions.
MyMovement class:
class myMovement : public NxOgre::CharacterMovementVectorController
{
public:
void move(NxVec3 &out, NxVec3 &moveVector, NxQuat &direction, NxVec3 &g, float t, NxOgre::Character*)
{
NxReal mySpeed = 10.5;
out = ((direction.rot(moveVector) * mySpeed) + g) * t;
}
};
Assigning it to my character:
m_pPlayer1Character->setMovementVectorController(new myMovement());
And here the movements are added:
if(m_pKeyboard->isKeyDown(OIS::KC_LEFT))
{
m_pPlayer1Character->addMovement(NxOgre::Character::Direction::DR_StepLeft);
}
if(m_pKeyboard->isKeyDown(OIS::KC_RIGHT))
{
m_pPlayer1Character->addMovement(NxOgre::Character::DR_StepRight);
}
if(m_pKeyboard->isKeyDown(OIS::KC_UP))
{
m_pPlayer1Character->addMovement(NxOgre::Character::DR_Forward);
}
if(m_pKeyboard->isKeyDown(OIS::KC_DOWN))
{
m_pPlayer1Character->addMovement(NxOgre::Character::DR_Backward);
}