dbrock
19-01-2008 05:43:35
I've been playing around with the Character class for just about the entire day now, and so far I have a moving character which reacts very well with my scene. The next step is rotating the character along the Y axis (spinning).
I'm doing that with the following code
The character only wants to spin while I'm moving.
The video can be viewed by going here: http://deadcold.smallchangestudios.net/movie.wmv
Is there any way around this?
I'm doing that with the following code
if(mInputHandler->isKeyDown( OIS::KC_I) )
{
chester->addMovement( Character::DR_Forward );
}
if(mInputHandler->isKeyDown( OIS::KC_K ) )
{
chester->addMovement( Character::DR_Backward );
}
if(mInputHandler->isKeyDown( OIS::KC_L ) )
{
chester->addMovement( Character::DR_StepLeft );
}
if(mInputHandler->isKeyDown( OIS::KC_J ) )
{
chester->addMovement( Character::DR_StepRight );
}
OIS::MouseState ms = mInputHandler->getMouseState();
int relX = ms.X.rel;
if( relX != 0 )
{
Quaternion q;
q.FromAngleAxis( -Radian( relX * 0.15 * deltaTime ), chester->getGlobalOrientation() * Vector3::UNIT_Y );
q = q * chester->getGlobalOrientation();
chester->setDirection( q );
chester->addMovement( Character::DR_None );
}
The character only wants to spin while I'm moving.
The video can be viewed by going here: http://deadcold.smallchangestudios.net/movie.wmv
Is there any way around this?