GRIM: Fix angles handling in keyframe animations.

This commit is contained in:
Giulio Camuffo 2011-09-30 17:43:20 +02:00
parent ba10e07422
commit 3e08fb915b
3 changed files with 5 additions and 4 deletions

View File

@ -1074,6 +1074,7 @@ void Actor::update(float frameTime) {
if (_turning) {
float turnAmt = g_grim->getPerSecond(_turnRate) * 5.f;
Math::Angle dyaw = _destYaw - _yaw;
dyaw.normalize(-180);
// If the actor won't turn because the rate is set to zero then
// have the actor turn all the way to the destination yaw.
// Without this some actors will lock the interface on changing

View File

@ -69,7 +69,7 @@ void Animation::play(RepeatMode repeatMode) {
void Animation::fade(FadeMode fadeMode, int fadeLength) {
if (!_active) {
if (fadeMode == FadeIn) {
_repeatMode = Once;
_repeatMode = Once;//FadeAtEnd;
_time = -1;
_fade = 0.f;
_paused = false;

View File

@ -273,13 +273,13 @@ bool KeyframeAnim::KeyframeNode::animate(ModelNode &node, float frame, float fad
node._animPos += (pos - node._pos) * fade;
Math::Angle dpitch = pitch - node._pitch;
node._animPitch += dpitch * fade;
node._animPitch += dpitch.normalize(-180) * fade;
Math::Angle dyaw = yaw - node._yaw;
node._animYaw += dyaw * fade;
node._animYaw += dyaw.normalize(-180) * fade;
Math::Angle droll = roll - node._roll;
node._animRoll += droll * fade;
node._animRoll += droll.normalize(-180) * fade;
return true;
}