- تم التحرير
Springbones and disabling path constraint at runtime
Hi,
I have a character skeleton which is similar to Stretchyman. when he is on land he walks with IK and skeleton utility ground constratint. however when he is diving in the water i want his legs to animate dynamically at rutime, his legs following freely behind the whole body in the 360* direction he sweems (like a rope or chains being dragged on a flat surface).
A similar issue I am facing is with his hair: i want his hair to move around dyncamically to his motion, except of specific animations in which i want to animate his hair menually.
the best solution for dynamic movement I have found is by using spring bones:
https://assetstore.unity.com/packages/tools/particles-effects/easy-springbone-177872
I intended to use spring bones on the override bones and activate it when the character is in the water, however, as the bones are following the path at unity-spine runtime, the bones override won't effect the bones. same is for the hair.
I will be glad if there is a solution for the problem or even a better way to implement the scenerio. any help would be highly appriciated!
The usual way of disabling (the effect of) a constraint at runtime is to set the mix
value via script, something like this:
IkConstraint constraint = skeletonAnimation.Skeleton.FindIkConstraint("aim"); // or FindTransformConstraint, etc.
constraint.Mix = 0;
Alternatively you could also have your animations set the constraint value to 0 or 1, e.g. having walk
that sets a constraint mix value of 1 and walk-unconstrained-hair
with a mix value of 0.