• RuntimesUnity
  • Spine 4.2 Physics - General Questions

@bantam Sorry to hear you've encountered problems, thanks for reporting! This sounds like the bug with wind and gravity which has been fixed just 4 days ago:
EsotericSoftware/spine-runtimes2446 (via this commit)
Could you please have a try whether the very latest spine-unity package resolves the issue on your end?

    Related Discussions
    ...

    Harald

    Thanks for responding, I may have I have missed a step to make it work, do we need to programmatically provide a gravity level in Unity somewhere? I didn't see a method for it through the SkeletonAnimation api.

    Downloaded and run with spine-unity 4.2-beta (updated 2024-01-12), if it's not this version please let me know I will test again. I think it is correct though as I see the changes in the source.

    I added a couple of break points to see if it hits those changes and it does, it seems to be applying gravity to the data structure.

    Seems to make it to PhysicsConstraint.cs constructor

    makes it down here

    Also tried it with another one of our spines that uses 100 gravity for hair with a test pose to make it more obvious, 2023 blank project with default unity settings with SkeletonAnimation pulled into an otherwise blank scene to make sure its not any of our current projects settings screwing things up.

    Hair not applying gravity

    100 Gravity hair successfully working in Spine Editor

    These gravities are set up in the setup pose in editor not in the animation timeline if that helps.

    P.S. these physics constraints have really been impressive! It's a game changer for our productivity.

      @bantam Apologies if the issue was not fixed with the latest package! We will have a look at it right away.

      bantam I may have I have missed a step to make it work, do we need to programmatically provide a gravity level in Unity somewhere?

      No setup is required on the Unity side, the gravity settings are in skeleton-space and should work regardless of your Unity setup.

      bantam P.S. these physics constraints have really been impressive! It's a game changer for our productivity.

      Very glad to hear, thanks!

      We've fixed this in 4.2.10-beta! It is correct at runtime.

        un mes más tarde

        Nate
        @Harald

        No gravity still happening in 4.2.14-beta and 4.2.15-beta editor and spine-unity-4.2-2024-02-15-beta

        vs Unity

        minimum test case with 2 bones, 1 with and 1 without a physics constraint with gravity at 100, brand new spine made with latest beta editor

        vs unity in play mode showing no gravity (brand new empty project), just using a Skeleton Animation dragged into scene

        Sent this test project along with the test spine to the contact mail. Please take a look.

        @bantam Sorry for the troubles, thanks for sending the reproduction project, we received everything. We will get back to you here on the forum once we've figured out what's going wrong.

        6 días más tarde

        We've fixed this in 4.2.24-beta by adding a reference scale field to skeletons. It's fixed in spine-libgdx and will be ported to spine-unity and the other runtimes soon, likely Monday (tomorrow).

        Thanks for your help identifying this issue!

        I gave it a test with the latest editor and package and gravity works now!! Thank you! This is such a great feature sincerely.

        I noticed one issue, I think the issue is in editor not unity. Take the physics bone from last spine, nested split it into 4 bones, give it a quick mesh and weight it like normal and apply physics constraint to every bone with default settings and 100 gravity. In editor it curls around ignoring gravity or like it's doing something related to the parent bone.

        (can't seem to upload images to the forum so I will put them on dropbox)

        In unity I feel it does what you expect coming to a natural rest to gravity

        I've put the images demonstrating this along the new test spine with the mesh and bones to test this issue in the dropbox link also in case it helps!

        https://www.dropbox.com/scl/fo/b6yctecqdac6no38hqnzi/h?rlkey=g2jytges7qjfw1ge4u7z9vnpe&dl=0

        Thanks for the project file. I tried this in 4.2.25-beta:

        1. Export to JSON.
        2. Import Data, 0.1 scale.

        The result is correct:

        The imported skeleton has the expected reference scale of 10 (normally 100).

        If I checked the wrong thing, please let me know what are the reproduction steps!

        We'll look into the forum not allowing uploads, I see it too.

          Nate

          Thanks for responding. The issue is that spine editor and Unity implement this differently. 100 gravity on all 4 bones in unity flops down towards gravity in an expected way (check the Unity png in the dropbox link). In the editor it curls away from gravity. If it's correct in editor then it really needs to behave the same way in Unity so animators can rely on it working reasonably similar to how it behaves in editor. Otherwise they will have to load up unity every time to adjust the gravity to look right which in my experience they are most averse to leaving editor.

          I added Flop Difference Unity.zip to the dropbox so you can see the gravity difference in Unity
          Assets/Scenes/test.unity

          https://www.dropbox.com/scl/fo/b6yctecqdac6no38hqnzi/h?rlkey=g2jytges7qjfw1ge4u7z9vnpe&dl=0

          I see what you mean now. In the editor the constraint order is 2d, 2c, 2b, 2 (from the top down):
           Loading Image
          In the JSON file it's 2, 2b, 2c, 2d (the order field, 0 if omitted):

          { "name": "bone2", "bone": "bone2", "rotate": 1, "inertia": 0.5, "damping": 0.85, "gravity": 100 },
          { "name": "bone2b", "order": 1, "bone": "bone2b", "rotate": 1, "inertia": 0.5, "damping": 0.85, "gravity": 100 },
          { "name": "bone2c", "order": 2, "bone": "bone2c", "rotate": 1, "inertia": 0.5, "damping": 0.85, "gravity": 100 },
          { "name": "bone2d", "order": 3, "bone": "bone2d", "rotate": 1, "inertia": 0.5, "damping": 0.85, "gravity": 100 }

          In this case the editor behavior is correct, but the export is reversed. We'll fix this in 4.2.26-beta. Cheers!

            Nate

            Full success with 4.2.26-beta thank you for all the help! Also wasn't aware that constraint order affected physics constraints (when I flipped the test spine order it looked like unity which makes sense now) super useful information that I will pass on!