• RuntimesUnity
  • Physics Related Question : Separate Gameobject transform from Skeleton bones ?

Harald
Something that could be usefull too is a "strengh modifier" on the physics, gameobject movement related.
For me it's usefull because I wanted to add a little physics on the scrollview for choosing the character, but it can be usefull for more common things, like level with a lot of gravity and one with zero gravity or so.

It's just an idea though... I'm gonna see if I can implement it myself easilly or not 🤔

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

    Pentacles
    For the "strenghtener" it was pretty simple, a simple float to multiply here :
    skeleton.PhysicsTranslate(positionDelta.x * physicsStrenghtener, positionDelta.y * physicsStrenghtener);
    The most difficult was to actually add it to your awersome Editor script 🫡

    Something nice would be a limiter to ensure it doesn't go outside a certain point, but I'm not sure if this is doable at the moment ... Gonna check it too !

    Your scripts are all well documented 👍

    @Pentacles A strength modifier is a cool idea, thanks for your input! Basically all that needs to be done is to multiply the translation or rotation delta with a multiplier parameter that defaults to 1.0. I will give it some more thought and potentially test and add that feature next week.

    @Pentacles Sorry, I should have refreshed the browser tab before posting, you already implemented it 🙂. Glad to hear it was easy to add for you, thanks for your kind words! 🙂

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

      Harald
      No problem, the modifier was pretty easy, but the limiter doesn't work great 😅

      I tried a clamp at the same location but then it start looking like it's lagging when slowing down...
      I suppose it would be more on the "PhysicsConstraint" class, but as it is not yet implemented in spine itself I don't think I can do it in Unity, right ? (If I remember right, there was a post to make a limiter on the physics in Spine)

      But I think being able to modify the strengh is always pretty nice 🙂 It gonna need a "physics" dropdown soon 🤣

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

        Pentacles No problem, the modifier was pretty easy, but the limiter doesn't work great 😅
        ..
        Pentacles I suppose it would be more on the "PhysicsConstraint" class, but as it is not yet implemented in spine itself I don't think I can do it in Unity, right ?

        Yes, we are planning to add a limiter on the Spine side of things (configured in the Spine Editor). Adding limiters outside of a skeleton (e.g. in the SkeletonAnimation component) will never be suitable for all scenarios unfortunately. It might take some time until we get to release this feature though, so it might still be a good idea if you use your solution in the meantime.

        Pentacles It gonna need a "physics" dropdown soon

        What kind of dropdown do you mean, what do you have in mind?

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

          Harald
          Well, for now I will use only the physics strengtener modifier. I am already hyped for the beta 4.2.10 (constraint folder... and repaired import... What to ask more ?) , but being able to limit it between value will be really great too !

          For the dropdown, it was more a joke than something serious, it's because there's a lot of stuff now for the physics.
          But I was thinking the same as the dropdown for "advanced" in the skeleton gameobject, where you have for now all the physics, multipleCanvasRenderer, those stuff.
          I don't know if dropdown is the right word though.

          Ah, you mean "foldout", that makes sense then, thanks for the clarification 🙂.

          • 編集済み

          @Pentacles FYI: We have just pushed a commit to the 4.2-beta branch which replaces the ApplyTranslationToPhysics and ApplyRotationToPhysics bool properties (and their Inspector counterparts Transform Translation and Transform Rotation) with Vector2 and float scale-factor properties. This covers disabling the feature by setting the factors to 0.

          A new spine-unity 4.2-beta unitypackage is available for download as well:
          https://esotericsoftware.com/spine-unity-download#spine-unity-4.2-beta

          From the changelog:

          PhysicsConstraints: bool properties ApplyTranslationToPhysics and ApplyRotationToPhysics were changed to Vector2 PhysicsPositionInheritanceFactor and float PhysicsRotationInheritanceFactor to allow the Transform movement the be scaled by a factor before being applied to the skeleton. You can set the properties to Vector2.zero and 0 respectively to disable applying any Transform movement at all. The Advanced Inspector section Physics Constraints was renamed to Physics Inheritance, the properties in the section are now called Position and Rotation.

          PhysicsConstraints: Skeleton GameObjects now automatically apply Transform translation and rotation to the skeleton's PhysicsConstraints. You can disable applying translation or rotation at the Skeleton component Inspector under Advanced - Physics Inheritance by setting Position to (0,0)and Rotation to 0, or by setting the properties physicsPositionInheritanceFactor to Vector2.zero and physicsRotationInheritanceFactor to 0 at the skeleton component via code.

          I would recommend you to back up your current project and update early if possible, since the property changes are breaking changes. In other words, you need to re-configure any of your custom Transform Physics Inheritance settings (either disabled or using a strength modifier other than 1), since the old bool parameter no longer exists and your own parameter is likely named differently. And it's better to do it early than late where you might then need to re-do more configuration work.

          If you want to migrate your own strength modifier parameter, you can add
          [UnityEngine.Serialization.FormerlySerializedAs("yourTranslationModifierVariableName")]
          before the line
          [SerializeField] protected Vector2 physicsPositionInheritanceFactor = Vector2.one;
          in SkeletonRenderer.cs and the same for physicsRotationInheritanceFactor before opening your scenes (or before opening Unity at all). Then you should not loose any of your settings.

          @Jamez0r Pinging you here as well just in case you've already updated to the previous package, so that you can avoid losing any settings as well.

          The documentation page will be updated accordingly very soon as well.
          Hope you like it 🙂.

            Harald
            Thanks for the tips of "UnityEngine.Serialization.FormerlySerializedAs", I didn't knew that !
            Well I'm probably gonna do this then.
            Nice idea to split it between position and rotation too !
            I'm gonna change it tomorow, I'm using it on two scenes only so it won't take long hopefully 🙂 I was waiting your official push 😉

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

              Harald Ooo, good idea with the scale value 👍️ and thanks for the heads up!

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

                Pentacles Thanks for the tips of "UnityEngine.Serialization.FormerlySerializedAs", I didn't knew that !
                Well I'm probably gonna do this then.

                Glad it helped!

                Pentacles Nice idea to split it between position and rotation too !

                And you can also easily split it between horizontal and vertical movement as well, just set the Position vector to e.g. (1, 0) to only get horizontal movement, or (2, 1) to get normal vertical but twice as intense horizontal movement. 🙂

                Jamez0r Ooo, good idea with the scale value 👍️ and thanks for the heads up!

                It was @Pentacles idea, so I hereby redirect the praise 🙂.

                @Pentacles FYI: We've also just added configurable default values for the Physics Inheritance Position and Rotation scale factor properties to Spine Preferences:
                https://esotericsoftware.com/spine-unity#Spine-Preferences
                This should save a lot of work when you e.g. want to e.g. set your Rotation scale factor to 0 (disabled) at all skeletons by default.

                Also, the spine-unity documentation page has been updated to reflect the updated physics Inspector properties.

                A new spine-unity 4.2-beta unitypackage is available for download:
                https://esotericsoftware.com/spine-unity-download#spine-unity-4.2-beta