mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[libgdx] Fixed worldToLocalRotation and localToWorldRotation to account for local rotation and shearX.
This commit is contained in:
parent
81af7309e8
commit
3851e201d8
@ -547,11 +547,12 @@ public class Bone implements Updatable {
|
||||
/** Transforms a world rotation to a local rotation. */
|
||||
public float worldToLocalRotation (float worldRotation) {
|
||||
float sin = sinDeg(worldRotation), cos = cosDeg(worldRotation);
|
||||
return atan2(a * sin - c * cos, d * cos - b * sin) * radDeg;
|
||||
return atan2(a * sin - c * cos, d * cos - b * sin) * radDeg + rotation - shearX;
|
||||
}
|
||||
|
||||
/** Transforms a local rotation to a world rotation. */
|
||||
public float localToWorldRotation (float localRotation) {
|
||||
localRotation -= rotation - shearX;
|
||||
float sin = sinDeg(localRotation), cos = cosDeg(localRotation);
|
||||
return atan2(cos * c + sin * d, cos * a + sin * b) * radDeg;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user