• RuntimesGodot
  • Flip on the X causes issues while using custom bone transforms

Hello,
I have been playing around with the spine godot 4.2.1 stable. It seems that if I use the same way of flipping spine boy as that used in example 4 get_skeleton().set_scale_x(-1). This appears to work fine until I try setting a bone transform off the world_transforms_changed signal. If I set a bone transform while the sprite is scaled in the -1 x, the sprite will flash between what I expect to see, as well as another that appears to be flipped on the -1 x and -1 y with broken feet animations (toes are facing the wrong direction during the walk animation).

The most basic way to reproduce what I am seeing is make a scene that contains a SpineSprite with a skeleton on it (I used spineboy from the examples), attach the following script to it, and attach the world_transforms_changed to the script.

extends SpineSprite

func _ready():
	get_animation_state().set_animation("walk", true, 0)
	get_skeleton().set_scale_x(-1)

func _on_world_transforms_changed(spine_sprite):
	var newTransform :Transform2D = get_global_bone_transform("root")
	set_global_bone_transform("root", newTransform)

I shrunk the test down to just using the root transform and setting it back onto the root bone to reduce the clutter of the IK code I have been attempting to do.

I am wondering if anyone has a good way to flip the skeleton on on the x while using custom bone transforms?

Related Discussions
...

Generally, I would minimize the use of code for manually transforming specific bones and instead rely on calling animations and setting their track number if possible. You may want to flip (scale) the sprite through the SpineSprite Node:

SpineSprite.scale.x = 1
or
SpineSprite.scale.x = -1