@fshakhverdiyev Glad it helped, thanks for getting back to us!
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);
afterskeleton.SetSkin()
when the call is followed by_skeletonRagdoll2D.Apply();
. This is necessary because the world transform values need to be updated beforeSkeletonRagdoll2D.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 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 callskeletonAnimation.Update(0);
afterwards as documented here to immediately reflect your changes.@fshakhverdiyev Thanks for the additional info. It's still hard to help based on the limited information above though.
What is the exact code that you use to switch skins and enable/disable ragdolls that leads to your issue?
What does your skin setup look like before and after the problematic switching?
Do you have skin-bones which are present in one skin and not present in another?
What does your bone hierarchy look like in Spine at the problematic skin, and how does the respectiveSkeletonUtilityBone
hierarchy look like in the Unity Hierarchy window?@fshakhverdiyev
SkeletonRagdoll2D
usesstartingBoneName
and astopBoneNames
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.@fshakhverdiyev We've just tested the above hierarchy, which works as intended on our end:
root // you scale that -1 and 1 - rootBone // this is your bone assigned at the SkeletonRootMotion component -- hip and other skeleton bones
So unfortunately we could not yet reproduce any issue on our end. Could you please describe your bone hierarchy and scaling setup?
@fshakhverdiyev How did you mirror the skeleton to chieve the direction flip? In general the
SkeletonRootMotion
component should work automatically with flipped x direction movement.