Hi everyone!
So, I'm new using the Spine, in fact I'm not a user of the Spine itself... I'm a programmer and I'm just trying to solve an issue with Unity.

After some updates I just don't know why our characters are getting a very weird behaviour when enabling the ragdoll. Sometimes the bevhaviour is as expected, but sometimes the character/humanoid just start to "explode" moving too fast and deforming the mesh. With a smaller value of "Mass Falloff Factor" the issue occurs less often, but still happens and the result is not cool because the character seems to rigidy.

I found in another post (https://zh.esotericsoftware.com/forum/d/16633-spine-2d-ragdoll-constraints/3) a possible solution for the isssue commenting the "#define HINGE_JOINT_NEW_BEHAVIOUR"... But the issue still happens.

I'm out of ideas to solve the problem.
The Unity is the 2021.3.9 and the Spine (used by the artist is the 3.8.95)

I'll appreciate a lot some help here. Thank you very much <3

Related Discussions
...

Hi... I'm still strugling with this issue. Cn anyone help?

Thanks 🙂

After some updates I just don't know why our characters are getting a very weird behaviour when enabling the ragdoll.

What kind of updates did you perform? Which version of the spine-unity runtime are you using (name of the unitypackage, also listed in Assets/Spine/version.txt)? It's hard to diagnose a physics problem from text and Inspector settings alone.

In general the SkeletonRagdoll2D component only generates a hierarchy of linked Rigidbody2D GameObjects, just with some initial properties and sizes matching the bone hierarchy. The simulation of the rigidbodies is performed by Unity physics.

Could you send us a minimal Unity project that still shows your issues? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context, then we can have a look at it.

  • ricna님이 이에 답장했습니다.

    Harald Hi Harald! Thanks for you attention.

    So, the content of the version.txt is

    This Spine-Unity runtime works with data exported from Spine Editor version: 3.8.xx
    Package version: spine-unity-3.8-2020-06-08.unitypackage

    In general the SkeletonRagdoll2D component only generates a hierarchy of linked Rigidbody2D GameObjects, just with some initial properties and sizes matching the bone hierarchy. The simulation of the rigidbodies is performed by Unity physics.

    Yeah, I got this, but anyway seems that something maybe is interfering in the behaviour? Because is a random behaviour. The game is a platformer 2D, and when you hit an enemy the death calls the ragdoll.Apply() and then the code add some Impulse considering the hit direction... In most cases everything is ok, but sometimes (and now more often) the ragdoll move too fast as if there is a lot of collision between the bones then the whole character deforms streching the mesh while the movement of the bones are fast in opposite directions.

    Could you send us a minimal Unity project that still shows your issues? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context, then we can have a look at it.

    The project is not mine and is huge. I'll need to ask persmission to send something, and I'm not sure how to recreate the same issue in another project. Maybe the problem is not the Spine, but I need to eliminate the possibilities.

    My guess is that is some conflict with versions, because the update mentioned is about the Unity. They where using a old version and when I start working in the project I started to update the Unity. So the mainly update is the Unity itself.

    Should I update the Spine package to get this more safety? The problem is the artist will have too much work to recreate all the Characters and re-export all characters (theres a lot of characters).

    What do you suggest?

    Thank you again

    [..] The game is a platformer 2D, and when you hit an enemy the death calls the ragdoll.Apply() and then the code add some Impulse considering the hit direction... In most cases everything is ok, but sometimes (and now more often) the ragdoll move too fast as if there is a lot of collision between the bones then the whole character deforms streching the mesh while the movement of the bones are fast in opposite directions.

    If behaviour is as expected most of the time, it seems more like a general issue with Unity's physics (and physics settings) than with the collider and rigidbody setup. You might want to check out different Project Settings - Physics 2D settings, which might stabilize your simulation. It could e.g. be beneficial to set Max Linear Correction, Max Angular Correction, Max Translation Speed, Max Rotation Speed to the lowest values that still permit normal gameplay. Increasing iteration counts also stabilizes the physics simulation, however comes at an additional performance overhead.

    In general I'm afraid there is not much that can be done on the spine-unity runtime side which fixes this issue. On the ragdoll side of things, you might just want to try if creating thinner colliders would improve the situation of overlapping colliders resulting in stretching or explosion.

    Usually such undesired quick stretching or explosion effects are caused by a situation where strong forces or high velocity lead to parts intersecting (penetrating) each other by a large amount, which are not allowed to do that and should be colliding instead. This can't really be avoided in a discrete stepped simulation, the problem is just if rigidbodies overlap too much. The resulting de-penetration correction forces or velocities then lead to such sudden unnatural movement when things are pushed back out. The situation then gets worse when more than two rigidbodies overlap and the simulation can't find a simple way to "untangle" everything, moving parts too far apart.

    General solutions to such issues include increasing simulation iteration counts, which reduces penetration distances and thus lowers the de-penetration correction forces; reducing maximum de-penetration distances, angles or forces, or even writing a custom script to move a GameObject back to it's normal position (e.g. at the joint). The latter however should be performed with caution and is likely not recommended your case, in order to not cause follow-up issues.

    This Spine-Unity runtime works with data exported from Spine Editor version: 3.8.xx
    Package version: spine-unity-3.8-2020-06-08.unitypackage

    Thanks for the additional info. Please note that you're not using the latest available 3.8 spine-unity package (which is from 2021-11-10).
    While you could check if using the latest 3.8 spine-unity runtime package resolves your issue, it is rather unlikely to help, unless the initial rigidbody angle limits are wrong (which was resolved in a bugfix for newer Unity versions). As always, be sure to backup your project before performing any updates.

    • ricna 님이 이 게시물을 좋아합니다..