GRIM: Fix angles handling in keyframe animations.
This commit is contained in:
parent
ba10e07422
commit
3e08fb915b
3 changed files with 5 additions and 4 deletions
|
@ -1074,6 +1074,7 @@ void Actor::update(float frameTime) {
|
||||||
if (_turning) {
|
if (_turning) {
|
||||||
float turnAmt = g_grim->getPerSecond(_turnRate) * 5.f;
|
float turnAmt = g_grim->getPerSecond(_turnRate) * 5.f;
|
||||||
Math::Angle dyaw = _destYaw - _yaw;
|
Math::Angle dyaw = _destYaw - _yaw;
|
||||||
|
dyaw.normalize(-180);
|
||||||
// If the actor won't turn because the rate is set to zero then
|
// 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.
|
// have the actor turn all the way to the destination yaw.
|
||||||
// Without this some actors will lock the interface on changing
|
// Without this some actors will lock the interface on changing
|
||||||
|
|
|
@ -69,7 +69,7 @@ void Animation::play(RepeatMode repeatMode) {
|
||||||
void Animation::fade(FadeMode fadeMode, int fadeLength) {
|
void Animation::fade(FadeMode fadeMode, int fadeLength) {
|
||||||
if (!_active) {
|
if (!_active) {
|
||||||
if (fadeMode == FadeIn) {
|
if (fadeMode == FadeIn) {
|
||||||
_repeatMode = Once;
|
_repeatMode = Once;//FadeAtEnd;
|
||||||
_time = -1;
|
_time = -1;
|
||||||
_fade = 0.f;
|
_fade = 0.f;
|
||||||
_paused = false;
|
_paused = false;
|
||||||
|
|
|
@ -273,13 +273,13 @@ bool KeyframeAnim::KeyframeNode::animate(ModelNode &node, float frame, float fad
|
||||||
node._animPos += (pos - node._pos) * fade;
|
node._animPos += (pos - node._pos) * fade;
|
||||||
|
|
||||||
Math::Angle dpitch = pitch - node._pitch;
|
Math::Angle dpitch = pitch - node._pitch;
|
||||||
node._animPitch += dpitch * fade;
|
node._animPitch += dpitch.normalize(-180) * fade;
|
||||||
|
|
||||||
Math::Angle dyaw = yaw - node._yaw;
|
Math::Angle dyaw = yaw - node._yaw;
|
||||||
node._animYaw += dyaw * fade;
|
node._animYaw += dyaw.normalize(-180) * fade;
|
||||||
|
|
||||||
Math::Angle droll = roll - node._roll;
|
Math::Angle droll = roll - node._roll;
|
||||||
node._animRoll += droll * fade;
|
node._animRoll += droll.normalize(-180) * fade;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue