Unity Animation And Physics Binding - is attempt to make simple tool for blending animations with physic. It is not production ready, it is prototyte, that can be used as start of your realisation.
Made with Unity 2020.1
- You should create two game objects: one for reference animation (for example using Animator Controller, or script), second for physic (for example with rigidbody)
- Add script
AnimationBlender
to any root bone you want to animate.AnimationBlender
will apply animation from reference animation object to this object and all his children. - Setup all parameters
Reference
- object for taking animationCheck Bones Names
- Should we fail if bones name are not equalAnimation Factor
- How much animation updates should be appliedResolve Factor
- How much physic body should try to return to animation angles (bigger values - closer to animation, but bigger jitter with physic)Ingore
- A list of Transforms to ignore (animation will not be applied)
- To make character stay in the place you need to ignore one bone, for example, hip and make its rigidboby Kinematic. It will allow the animation
- Joints should be set up depends on your animation. Movement of your animations will be not so intensive if it is not allowed by joints
- Physic will affect the doll, even if you will set all parameters to the maximum. So you will never have animations that look 100% as original
- Algorithm depends on bones' game objects transforms order, names, and hierarchy. It will not work if it is not equals