- Home /
Mecanim and Physics
Hello,
Im working on a new title right now and I wanted to try out mecanim. I've watched its tutorial and it is indeed impressive to see how easily such motion is achieved using the system.
However, I ran into my first problem using it not long before I started. My game involves a lot of physics, projectiles that hit the target need to push it back, knock enemies out of the arenas, etc, which I was doing without much problem before. I just add force to rigidbodies on collision and they fly away.
However, once I put my mecanim animated character, just standing there on idle, it doesnt move when hit, as if it was a kinematic rigidbody (which it isnt).
How can I have my character move using mecanim for fluid motion, but still be affected by world physics?
PS: The push back mechanics are working on legacy animated/moved characters
Thx for the attention
Answer by dl_studios · Apr 02, 2013 at 08:30 AM
Click on your character. In the inspector you'll see in the Animator a check box: "Apply Root Motion." Disable this and you will be able to knock your guy about using addForce or whatever physics you like all at the same time playing its animation. Obviously you'll want to use root motion most of the time or your guy will just run in place when you use the controls, so you'll need to disable "Apply Root Motion" in script during events such as getting hit.
Answer by wholebitmedia · Jan 27, 2014 at 10:01 PM
Hello, i didnt want to start a new thread but I am using the demo version and find that I am having the same issue with having no collision detection with my mecanim character except for the floor. I checked the physics in the input prefs and tried the above root motion solution as well. Ive set up a capsule collider and it seems to ignore everything but the groundplane. The script makes reference to the rigidbody component. Perhaps the collider and the rigifbody are in conflict. Is this a Pro only issue?
Answer by Kavorka · Feb 02, 2014 at 05:21 PM
Hello
Check out if this asset could be of any use AnimFollow from Kavorka Games
You can have a character be 100 % ragdoll and adjust the strength of the ragdoll´s individual limbs. For the scenario you describe, the included ragdoll control script sounds to be what you are looking for or close enough to have it work after some modifications.
Best of luck
Patrik