I set up my character to flip direction based on the documentation (with Set Scale X) but my character's physics bones still point the opposite direction.

Any idea how to fix this? UE 5.4.4 and Spine 4.2 if it matters!

  • Misaki がこの投稿に返信しました。
    Related Discussions
    ...

    Versy I think that calling the ResetPhysicsConstraints() method should do the trick. This method is not yet mentioned in the spine-ue runtime documentation, so check the script to see what it does:
    EsotericSoftware/spine-runtimesblob/c85000b5f81bd93bcdd9cd2ae6e3789ac2907492/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp

    • Versy がこの投稿に返信しました。

      Misaki

      Thank you for your response and the suggestion! I tried out ResetPhysicsConstraints() with a debug key but all it did was return the physics bones to their original position for that frame then blew the wrong way again. Which made me realize... I think this is a problem with my rig setup.


      I have wind and gravity physics in Spine making them point to the left on my run animation, and I guess this doesn't get mirrored when the skeleton is flipped in engine. I'm guessing wind and gravity are no-go's if you're re-using animations? Let me know if you have any suggestions outside of manually animating these parts of the rig.

      Thanks again!

      • Misaki がこの投稿に返信しました。

        Versy Ah, that makes sense. If the Wind parameter of the Physics Constraint is used to animate the bones, then changing the scaleX of the Skeleton will move them in the same direction, which is the expected behavior.

        Similar results can be seen in the Spine editor. (Setting the skeleton's scaleX to -1 via code is technically different from setting the root bone's scale X to -1, since everything can be scaled, regardless of the inheritance settings for each bone):

        Instead of changing the scale of the skeleton, it would be better to flip the character by changing the scale of the actor. (I think it should work, but I haven't had time to test it yet.)

        As far as I have tried, the actor's scale can reverse the direction of movement set with the Wind parameter, so you may want to do that:

        • Versy がこの投稿に返信しました。

          Flipping the actor would do it. Flipping the skeleton (not the root bone) using -1 scaleX should also do it.

          Misaki

          Thanks for the tip! Flipping the actor worked, though, I discovered this causes problems when the actor has a capsule collision component on it (because it's flipping that too)! Instead, I flipped the Spine Skeleton Renderer and that did the trick! I think I assumed it would show the back of the skeleton's draw order (which is an issue I was having earlier) so I didn't try it 😅.

          • Misaki がこの投稿に返信しました。
          • Misaki が「いいね」しました。

            Versy Glad to hear the issue has been resolved! Thanks for sharing your solution with us! 😃

            The only downside to this is that the physics doesn't continue through the "flip" (the ears would flop when the character turns which looks really good), so flipping the skeleton is the ideal solution but then allowing flip of individual bones (to fix the hoodies strings going the wrong way for example).

            I poked through all available functions and found Get Bone World Transform, which made me think I could use scale on that to flip a single bone (the ones with Wind physics). Unfortunately, there's no matching "Set Bone World Transform". I assume this is for a good reason, but wondering if there's functionality to flip individual bones in here somewhere that I'm missing.

            • Misaki がこの投稿に返信しました。

              Versy

              Unfortunately, there's no matching "Set Bone World Transform". I assume this is for a good reason, but wondering if there's functionality to flip individual bones in here somewhere that I'm missing.

              As a matter of fact, the set method can only be used from C++ code. This is explained in the following section of the documentation:
              spine-ue Runtime Documentation #Getting and Setting Bone Transforms

              The spine-cpp runtime documentation is more detailed about what can be done with C++ code, so please refer to that as well:
              spine-cpp Runtime Documentation #Bones

              • Versy がこの投稿に返信しました。
                • 編集済み

                Misaki

                Ahh! I'll do some reading on this then and see if it's worth the hassle or if I should just try adjusting my rig to not use wind physics. Thanks again!

                • Misaki が「いいね」しました。