[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:
pharan 2018-10-24 23:57:49 +08:00 committed by GitHub
parent 3851e201d8
commit 8c55b1b5d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,10 +329,11 @@ namespace Spine {
public float WorldToLocalRotation (float 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) {
localRotation -= rotation - shearX;
float sin = MathUtils.SinDeg(localRotation), cos = MathUtils.CosDeg(localRotation);
return MathUtils.Atan2(cos * c + sin * d, cos * a + sin * b) * MathUtils.RadDeg;
}