mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[libgdx] Prevent rotation from spinning out of control.
For example, when diff is -360 at the == 0 check, it later becomes 0.
This commit is contained in:
parent
1ed6d7c485
commit
7996f2bae0
@ -356,10 +356,10 @@ public class AnimationState {
|
|||||||
// Mix between rotations using the direction of the shortest route on the first frame.
|
// 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 r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||||
float total, diff = r2 - r1;
|
float total, diff = r2 - r1;
|
||||||
|
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
|
||||||
if (diff == 0)
|
if (diff == 0)
|
||||||
total = timelinesRotation[i];
|
total = timelinesRotation[i];
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
|
|
||||||
float lastTotal, lastDiff;
|
float lastTotal, lastDiff;
|
||||||
if (firstFrame) {
|
if (firstFrame) {
|
||||||
lastTotal = 0;
|
lastTotal = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user