I’m developing a flick soccer kind of game. I know coding to an extent and I’m really new to animating things.
On searching through this forum I found that the best way to animate is to use the Unity mecanim. I also downloaded the unity mecanim character animation pack. The thing that baffled me was the character was animated in such a way that it was moving without any scripting, or may be there was some script for moving the character, which I might have missed. If I have not missed anything, and if my assumption of “animate as if the character was tied to a rope, move it with a script later” so that we can have more control on the animation later.
Kindly suggest me how should I proceed with this.
P.S. I want to animate a goalkeeper so that he can save the ball from ending up into the net.
Ok first off if you’re planning to use mecanim check out this 1 hour-ish long tutorial by Unity. Unity 4.0 - Mecanim Animation Tutorial - YouTube
I actually needed only the first fifteen minutes or so, but it helped me a TON.
You seem confused about how the character way moving without script. Let me clear that up for you. When a gameobject has an animator controller on it, it has the option of “Applying root motion”. Having it checked means the animations can move the actual player. The animations are created in another software. I’d recommend Blender or 3DS Max; I have both. I usually have my charaqcter move by script and disable root motion, but since you’re animating a goalkeeper, I think you should have it enabled.
So to animate your goalkeeper, I’d do these steps:
- Make a goalkeeper character. Rig it in a T-Pose for best results. You can animate your character in the same software you created it.
- I’d recommend 6 animations: One for jumping far on the left, jumping far on the right, one jumping close on the left, close on the right, and two for bending down and grabbing the ball from right below him and the ball right above him.
- Import to Unity. This is different for different software but exporting each animation as a FBX file is a good idea.
- Click on your character model and go to the rigging tab and change his type to “Humanoid”.
- Now make an animator for the goal keeper and edit it to have all the animations stem from an idle pose
- Make your script detect where the ball is in relation to the player. I’d use box colliders but you can do whatever you want. Then call the animation function from the goalkeeper script.
- Don’t forget to add some perlin noise to the jump to make sure the goalkeeper doesn’t always save the ball
Mecanim is a state-driven animation system. You write scripts that move the Animator controller between various states, and each state has an associated animation.
If your character’s animator controller is currently in the “Climbing a rope” state (perhaps that is the default state for your controller) and none of the exit conditions are met, then that animation will simply continue to play without any scripting.