mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[libgdx] Fixed AnimationState not respecting MixBlend.first for rotate timelines.
This commit is contained in:
parent
7ee15d0627
commit
c7d71a8eb1
@ -342,12 +342,20 @@ public class AnimationState {
|
||||
RotateTimeline rotateTimeline = (RotateTimeline)timeline;
|
||||
Bone bone = skeleton.bones.get(rotateTimeline.boneIndex);
|
||||
float[] frames = rotateTimeline.frames;
|
||||
float r1, r2;
|
||||
if (time < frames[0]) { // Time is before first frame.
|
||||
if (blend == MixBlend.setup) bone.rotation = bone.data.rotation;
|
||||
switch (blend) {
|
||||
case setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
// Fall through.
|
||||
default:
|
||||
return;
|
||||
case first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
|
||||
float r2;
|
||||
} else {
|
||||
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - ENTRIES]) // Time is after last frame.
|
||||
r2 = bone.data.rotation + frames[frames.length + PREV_ROTATION];
|
||||
else {
|
||||
@ -363,9 +371,9 @@ public class AnimationState {
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - (int)(16384.499999999996 - r2 / 360)) * 360;
|
||||
}
|
||||
}
|
||||
|
||||
// Mix between rotations using the direction of the shortest route on the first frame.
|
||||
float r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
float total, diff = r2 - r1;
|
||||
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
|
||||
if (diff == 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user