JuiceTin

Hello, I've followed a tutorial but my ragdoll stays all messed up after it ends. Like the animation is mangled.
How can I get it to fully disable and return to normal?

(Note: This is for respawning after death, so no need for transitions)

public void StartRagdoll(Vector2 velocity){
Ragdoll.Apply();
Ragdoll.RootRigidbody.velocity = velocity;
}
public void EndRagdoll(){
Ragdoll.RootRigidbody.isKinematic = true;
Ragdoll.SetSkeletonPosition(Vector3.zero);
Ragdoll.Remove();
}
Also, his arm is attached using IK, however the gun doesn't move as shown. How can I sort of disable IK on the weapon temporarily so it moves with the body?
JuiceTin
  • Postovi: 13

Harald

Please always have a look at the provided example scenes first, in this case Spine Examples/Other Examples/SkeletonUtility Ragdoll that comes with the spine-unity runtime. These are working examples with code provided, any thirdparty tutorial videos might be outdated or obsolete.

From the provided RaggedySpineboy.cs example code you are most likely missing the ragdoll.SmoothMix(..) line. If you want to avoid that, you could issue a call to skeleton.SetBonesToSetupPose(); without any transition.
JuiceTin je napisao/la:How can I sort of disable IK on the weapon temporarily so it moves with the body?
To reduce the influence of a constraint you reduce the Mix value of it (it's just a shorter name for Influence). You can either key the Mix value of a constraint in an animation in the Spine Editor, or set it via code, e.g. ikConstraint.Mix = 0;.
Avatar
Harald

Harri
  • Postovi: 3907

JuiceTin

I was looking at the Skeleton Utility Ragdoll, however the SmoothMix didn't seem to work when set to 0 as an instant transition.
Didn't know about SetBonesToSetupPose, thanks!

Thankyou for the other info as well!
JuiceTin
  • Postovi: 13

Harald

Yes, using the shown SmoothMix procedure only makes sense when you want to smoothly fade out ikConstraint.Mix over multiple frames. Glad to hear you've figured it out, thanks for getting back to us!
Avatar
Harald

Harri
  • Postovi: 3907


Natrag na Unity