- Home /
Combining partial Mecanim animations (using avatar masks) with ragdoll physics
I've got a character animated using Mecanim, and, ideally, I'm hoping to be able to make parts of the character go limp under certain circumstances. Unfortunately, even when ignoring portions of the character using avatar masks, rather than being excluded from the animation system, it appears they are just locked in their initial pose. Is there a way to have rigidbody physics and mecanim simultaneously affecting different parts of a rig?
Answer by Streamfall · Nov 25, 2013 at 05:00 PM
That is a great question. Did you find a way to do this? I had a bit of success when I was masking out a section of a character's spine bone in order to rotate it via code, but I didn't like the effect that it had on the animation so I scrapped it temporarily.
I plan on working on this more over the next few days, so lets keep each other posted?
I'll be sure to keep this updated with my progress, but, so far, it seems like the animator simply disables the rigidbody completely. The only possibility I can imagine is making an invisible rigidbody skeleton that's locked to the model, then applies its position to the non-animated parts every frame. For obvious reasons, I don't want to resort to that.
Answer by Kavorka · Feb 02, 2014 at 05:23 PM
Hello Check out these videos AnimFollow from Kavorka Games
AnimFollow is a script that makes a ragdoll follow an animation. The strength of the ragdoll can be set by code in real-time on a per limb basis. The last video in the playlist shows an example where one leg is ragdollified but the rest of the character is controlled by mecanim. You may also set any limb to any strength, not just zero strength. If you lerp the strength back the character acts normal again.