fshakhverdiyev

  • il y a un mois
  • Inscrit 7 févr.

    @fshakhverdiyev Thanks for sending the reduced reproduction project.

    To fix the issue you need to call skeletonAnimation.Update(0); after skeleton.SetSkin() when the call is followed by_skeletonRagdoll2D.Apply();. This is necessary because the world transform values need to be updated before SkeletonRagdoll2D.Apply, and they are only updated for active bones.

    So to fix your code, modify it as follows:

    private static void ChangeSkin(SkeletonAnimation skeletonAnimation, Skin newSkin, bool updateWorldTransforms = false)
    {
        Skeleton skeleton = skeletonAnimation.skeleton;
        skeleton.SetSkin(newSkin);
        skeleton.SetSlotsToSetupPose();
        if (updateWorldTransforms)
            skeletonAnimation.Update(0);
        else
            skeletonAnimation.state.Apply(skeleton);
    }
    ...
    if (_isEnable)
    {
        ChangeSkin(_skeletonAnimation, _skeletonAnimation.skeleton.Data.FindSkin(_skinName), true);
        _skeletonRagdoll2D.Apply();
    }

      fshakhverdiyev Thank you for resubmitting your Unity project! I have confirmed that I can reproduce the problem as shown in the video you sent us with the latest project files. We will check the cause of the problem later and give you a detailed answer. We appreciate your patience.

      fshakhverdiyev Thank you for sending us your Unity project. However, the .zip file you sent us was very large (about 1 GB) and not minimal in content. Please note that you can delete any files other than “Assets,” “Packages,” and “ProjectSettings. The Library folder in particular tends to be huge.

      By the way, I could not reproduce the same state you described with your Unity project. For more information, please see my reply to you by email with a video recording of my test results.

        @fshakhverdiyev Please note that bumping your thread to the top will make us reply last to yours, as we're replying by age. We will usually reply within a workday, no new posting will not be missed.

        fshakhverdiyev One answer i need : If my bones on "Exploded" Skin (which bone only has on this skin. Called this bone BoneX) goes to somewhere and after that i Remove ragdoll and change skin to "Normal" is BoneX goes to default position ?

        Bones do not change position back to the setup pose position by calling SkeletonRagdoll2D.Remove, if that's what you're asking. They stay where they are. However, subsequently applying animations might set your bone positions again, depending on what bones your active animations actually key.

        fshakhverdiyev If not how can i reset all bones on Exploded Skin ?

        See skeletonAnimation.Skeleton.SetBonesToSetupPose(). You may need to call skeletonAnimation.Update(0); afterwards as documented here to immediately reflect your changes.

          fshakhverdiyev I just checked regarding skin bones, the SkeletonRagdoll2D component should actually be able to add the rigidbody chains for disabled bones anyway, so this should not be the problem.

          Could you perhaps create a minimal Unity project which still shows this issue? You can send it as a zip file to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at it.

            fshakhverdiyev But can i use another skin for ragdoll ?

            You could write your own modified version of SkeletonRagdoll2D and do that, yes.

            fshakhverdiyev I can create skin in spine editor with constraints and use in unity as a ragdolled body. Is this good way ?

            I'm not sure I understand what you mean by this sentence, especially by "with constraints". If you meant Spine's Physics Constraints, then no, please note that a Physics Constraint is not colliding with anything, for example not with Unity's colliders of your scene.

            If you meant other constraints to then control your primary bones: you could do that, this could be a nice setup.

            If you mean whether you create a skin just to assign bones which shall be included in the ragdoll as skin-bones: you could do that as well, but I would not go that far just to define a set of bones.

              @fshakhverdiyev SkeletonRagdoll2D uses startingBoneName and a stopBoneNames list to control which bones to include in the ragdoll. You might rarely want to include all active bones, even of a limited active skin.

              Note that the SkeletonRagdoll2D component is just an example component, you might want to write your own custom component based on it if you have different needs (derived from the class or copied and modified accordingly).

                @fshakhverdiyev Spinebots answer is correct but might not be clear enough:
                Note the skin-bones are only processed when the respective skin is active:
                http://en.esotericsoftware.com/spine-skins#Skin-bones
                This is not true for "normal" bones. If you don't associate bones with skins and e.g. just have empty slots, the runtimes still update your bones as you might want to query bone location for e.g. letting particle effects or a held weapon follow the bone position and rotation.

              • Spine optimizes the update process by only calculating the bones and constraints that are part of the currently active skin. If your character is using the Normal skin with 4 bones, Spine will only update those 4 bones. The bones and constraints that are part of the Exploded skin with 25 bones will not be calculated unless that skin is active. This optimization helps in reducing unnecessary calculations and improving performance.

              • Yes, you can achieve this in Spine by using skin constraints. Skin constraints allow you to apply different constraints to bones based on the active skin. This means you can have a specific constraint for the AquaSuit pipe that is only active when the "AquaSkin" is applied. You can set up these constraints in the Spine Editor, ensuring that they are only active for the specific skin you want. This way, your character can have different physics behaviors depending on the skin that is active.

                For more detailed guidance, you can refer to the Spine User Guide on Skin Constraints and the blog post on Skin Constraints for Different Proportions.