Hi all,
I've been struggling with some odd results when setting IK control positions for a root flipped skeleton using the c runtime. I've tracked the issue to the spBone_worldToLocal function. This does not seem to take into account if a parent bone is flipped or not.
Changing it to something like this fixes the issue for me (though you prob want something for y flip as well):
void spBone_worldToLocalFlip(spBone* self, float worldX, float worldY, float* localX, float* localY)
{
float x = worldX - self->worldX, y = worldY - self->worldY;
float a = self->a, b = self->b, c = self->c, d = self->d;
//new flip code
a *= self->worldSignX;
d *= self->worldSignX;
float invDet = 1 / (a * d - b * c);
*localX = (x * a * invDet - y * b * invDet);
*localY = (y * d * invDet - x * c * invDet);
}
I'm surprised noone has come across this!
David.