mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-05 18:26:52 +08:00
[csharp] Fix world-to-local and local-to-world rotation functions to account for local rotation and shearX.
based on : 3851e201d8
This commit is contained in:
parent
3851e201d8
commit
8c55b1b5d0
@ -329,10 +329,11 @@ namespace Spine {
|
|||||||
|
|
||||||
public float WorldToLocalRotation (float worldRotation) {
|
public float WorldToLocalRotation (float worldRotation) {
|
||||||
float sin = MathUtils.SinDeg(worldRotation), cos = MathUtils.CosDeg(worldRotation);
|
float sin = MathUtils.SinDeg(worldRotation), cos = MathUtils.CosDeg(worldRotation);
|
||||||
return MathUtils.Atan2(a * sin - c * cos, d * cos - b * sin) * MathUtils.RadDeg;
|
return MathUtils.Atan2(a * sin - c * cos, d * cos - b * sin) * MathUtils.RadDeg + rotation - shearX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float LocalToWorldRotation (float localRotation) {
|
public float LocalToWorldRotation (float localRotation) {
|
||||||
|
localRotation -= rotation - shearX;
|
||||||
float sin = MathUtils.SinDeg(localRotation), cos = MathUtils.CosDeg(localRotation);
|
float sin = MathUtils.SinDeg(localRotation), cos = MathUtils.CosDeg(localRotation);
|
||||||
return MathUtils.Atan2(cos * c + sin * d, cos * a + sin * b) * MathUtils.RadDeg;
|
return MathUtils.Atan2(cos * c + sin * d, cos * a + sin * b) * MathUtils.RadDeg;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user