Harald Thanks! Helped me for finding this solutin : (i know it is not good way but my game is demo and our animator not active in this days. And that is why i need runtime solution for temporarly) :
It works fine now.
fshakhverdiyev

- 7 авг
- Регистрация: 7 фев
Mail sent
I cant solve yet. Help please
Spinebot I call this method on my ChangeSkin method :
Hi, i have some problem on skin changing. My character has 2 skin : Normal, Splitted.
When i start the game everything is correct :And when i die my skin change to Splitted :
And when i die Restart logic running everything goes back to start position :
But after restarting game my character has some problem with skin :
If i click Reload on SkeletonDataAsset (in editor) this issue fixed. But i cant fix this issue on script. Help please. Thanks!
Harald Man thanks a lot! Issue fixed.
Misaki Okay. I will send again with video recording and new .zip
Harald Sample project sent to contact@esotericsoftware.com this mail. skeletonAnimation.Skeleton.SetBonesToSetupPose(); skeletonAnimation.Update(0); this 2 line doesnt reset bone positions for Exploded Skin.
Harald Thanks a lot
Harald kindly reminder. Help pls
Any feedback ?
Harald I think i can handle this problem. I realize some bones must not collide but it is collide with ground. 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 ? If not how can i reset all bones on Exploded Skin ?
Harald Okay
Harald And yes some skin-bones present in one skin and not present in another
Harald Sorry for late response. We have many issues.
public static void ChangeSkin(SkeletonAnimation skeletonAnimation, Skin newSkin)
This is Skin change code part. I just call this method change my skin to another one after call skeletonRagdoll.Apply(). Everything is good at firstTime but second.....
{
Skeleton skeleton = skeletonAnimation.skeleton;
skeleton.SetSkin(newSkin);
skeleton.SetSlotsToSetupPose();
skeletonAnimation.state.Apply(skeleton);
}
This situation happened on only skin change procedure.
` public void Die(Vector2 damageComeFrom)
{
SlowMotionManager.Instance.ResetSlowMotion();
isTriggered = false;
SkeletonSkinUtil.ChangeSkin(skeletonAnimation, _skeletonAnimation.skeleton.Data.FindSkin("Exploded"));
_skeletonRagdoll2D.Apply();
_capsuleCollider2D.enabled = false;
_rigidbody2D.velocity = Vector2.zero;
_rigidbody2D.angularVelocity = 0;
enabled = false;
}public void OnRestart() { enabled = true; if (_skeletonRagdoll2D.IsActive) { _skeletonRagdoll2D.Remove(); } _skeletonAnimation.ClearState(); SkeletonSkinUtil.ChangeSkin(_skeletonAnimation, _skeletonAnimation.skeleton.Data.FindSkin("Normal")); _skeletonAnimation.skeleton.SetBonesToSetupPose(); transform.position = _wakeUpPosition; _isTriggered = false; _rigidbody2D.isKinematic = false; _rigidbody2D.velocity = Vector2.zero; _capsuleCollider2D.enabled = true; _isJumped = false; _skeletonAnimation.state.SetAnimation(0, "Idle", true); }`
Die method called when character die and after Restart called everthing go to start position. First time everthing works fine (Ragdoll functionality). But second time when Die called (After restart) character exploded
Harald Thanks. It means Spine's Physics Constraints
This scene does not contain skin switching @Harald . I know this scene but it cant help us. With one skin everything is fine but when i change skin this issue comes up
Harald But can i use another skin for ragdoll ? I can create skin in spine editor with constraints and use in unity as a ragdolled body. Is this good way ?
My ragdoll works very good at first time. Firstly i change spine skin and apply ragdoll everthing works perfectly. After that my character come to live (Remove ragdoll and SetBonesToSetupPose applied). Everthing is okay. If my character again fall to Ragdoll character exploded. I added ScreenShot below :
First time :
Second time :Is this true ? I cant understand completely. Because SkeletonRagdoll2d.Apply create joints, colliders etc. for every bone on character (all bones from all skins). Can i create one skin with physics contraints on spine and use this skin as a ragdoll on my game ? Is this good way ?