Loading Image
A smaller issue than my previous ragdoll errors! But still perplexing. With FlipX == false, the mixed rotation between the ragdoll-based angle and the animation-based angle is correct, but with FlipX == true, it appears to take the long way round.
I'm guessing that the issue is that if a bone is ragdolling at 359 degrees and needs to Mix to 1 degree, it's going to Lerp all the way round the circle rather than than take the two degree long path.
In /spine-unity/Modules/Ragdoll/SkeletonRagdoll.cs there is the following:
b.rotation = Mathf.Lerp(b.rotation, boneLocalRotation, mix);
b.appliedRotation = Mathf.Lerp(b.appliedRotation, boneLocalRotation, mix);
So it does seem like the Lerping function is doing that. What confuses me is what comes a few lines previously, because it seems like there's some work to try and accomodate this by adding 180 degrees:
if (flipOR) {
if (isStartingBone) {
if (flipX) boneLocalPosition.x *= -1f;
if (flipY) boneLocalPosition.y *= -1f;
boneLocalRotation = boneLocalRotation * (flipXOR ? -1f : 1f);
if (flipX) boneLocalRotation += 180;
} else {
if (flipXOR) {
boneLocalRotation *= -1f;
boneLocalPosition.y *= -1f; // wtf??
}
}
}
(The comment is not mine.)
Is this snippet not doing what it ought to? What's the correct angle maths for FlipX = true?