I'm making a platformer, so when the player is facing the opposite direction, I just want to mirror the graphics. I've set up a whole Skeleton2D with Bones, then set up InverseKinematics to help animate it.
The problem is that I can't find a way to make the thing work when mirrored. Scaling the target IK doesn't work. Multiplying the IK position by -1 also doesn't work properly. It does change the target bone rotation, but the bone rotates in the reverse direction (it "pushes" the bone away).
The closest I got to get it to work properly is by applying a negative scale to the affected bone after scaling the skeleton to -1, but even then, the image flips back to the right side.
Right now, I'm starting to think I'll have to use the IKs to create the animations only as the means to key the bone positions, as I can't figure out a way to make a flipped animation with IK targets. So, once all bones are keyed into the animations, I can safely delete the IKs
To reproduce:
- Make a Skeleton2D node, make 3 children Bone2D nodes, one being the parent of the other (B1 -> B2 -> B3)
- Create a Node2D to use as IK target
- On the Skeleton2D Inspector, add a new SkeletonModification and enable it
- Add a new Element to the SkeletonModification, of type TwoBoneIK (third option, from the bottom up)
- Joint Bone One = B2 (uppermost bone); Joint Bone Two = B3 (farthest most); Target = IK_Target
- Move the target around to see if it's working properly.
- Attempt to mirror it in a way that it doesn't break
TLDR - How do I horizontally flip a skeleton2D with IK without breaking the animations?