Depending on how far you want to go, there are some helpful tools included in the Spine-Unity runtime regarding physics interaction:
-
The SkeletonRagdoll2D
component can be used to transition to and from ragdolls. There is an example scene Spine Examples/Other Examples/SkeletonUtility Ragdoll
for you to play around.
-
The SkeletonUtilityKinematicShadow
component can be used to override parts of the skeleton animation with physics input. You can see it in action in the example scenes Spine Examples/Other Examples/Drunkboy
on the front-arm, as well as in the example scene Spine Examples/Other Examples/SkeletonUtility Animated Physics
on multiple parts of the raptor.
-
The SkeletonUtilityGroundConstraint
component serves to adapt the feet to the ground during animation. You can check out the example scene Spine Examples/Other Examples/SkeletonUtility GroundConstraint
.
-
In general, controlling Spine's IK targets is one of the best ways to deal with hybrid animation and physics driven scenarios. The Spine Examples/Other Examples/Drunkboy
shows what can be done via scripts and IK targets. A not so simple setup would be to create a dual setup:
-
one physics-sensitive representation of the character with rigidbody and bounding boxes which serves to pick up movement when other physics objects hit it (plus some springs that move it back into place), plus
-
an invisible second representation that plays back the animations and serves to provide IK target positions at hands, feet, head, etc.
Then you can move the center of the character back upon impact and still move the IK targets (hands, feet, etc) where the animation directs them to. However you will then need some more detection scripts that play back a 'FallDown' animation when the rigidbody has received too much force so that it shall do more than spring back. Note that such a setup is not too trivial and you should have some experience with Unity physics.
Maybe we are going to create an additional example scene that deals with your animation + impact scenario - I guess it would be nice to have at hand.