Creating the Avatar
After a model file (FBX, COLLADA, etc.) is imported, you can specify what kind of rig it is in the Rig tab of the ModelImporter options.
Humanoid animations
For a Humanoid rig, select and click . Mecanim will attempt to match up your existing bone structure to the Avatar bone structure. In many cases, it can do this automatically by analysing the connections between bones in the rig.
If the match has succeeded, you will see a check mark next to the menu
Also, in the case of a successful match, an Avatar sub-asset is added to the model asset, which you will be able to see in the project view hierarchy.
If Mecanim was unable to create the Avatar, you will see a cross next to the button, and no Avatar sub-asset will be added. When this happens, you need to configure the avatar manually.
Non-humanoid animations
Two options for non-humanoid animation are provided: Generic and Legacy. Generic animations are imported using the Mecanim system but don’t take advantage of the extra features available for humanoid animations. Legacy animations use the the animation system that was provided by Unity before Mecanim. There are some cases where it is still useful to work with legacy animations (most notably with legacy projects that you don’t want to update fully) but they are seldom needed for new projects.
Configuring the Avatar
Since the Avatar is such an important aspect of the Mecanim system, it is important that it is configured properly for your model. So, whether theautomatic Avatar creation fails or succeeds, you need to go into the mode to ensure your Avatar is valid and properly set up. It is important that your character’s bone structure matches Mecanim’s predefined bone structure and that the model is in T-pose.
If the automatic Avatar creation fails, you will see a cross next to the Configure button.
If it succeeds, you will see a check/tick mark:
Here, success simply means all of the required bones have been matched but for better results, you might want to match the optional bones as well and get the model into a proper T-pose.
When you go to the menu, the editor will ask you to save your scene. The reason for this is that in mode, the Scene View is used to display bone, muscle and animation information for the selected model alone, without displaying the rest of the scene.
Once you have saved the scene, you will see a new Avatar Configuration inspector, with a bone mapping.
The inspector shows which of the bones are required and which are optional - the optional ones can have their movements interpolated automatically. For Mecanim to produce a valid match, your skeleton needs to have at least the required bones in place. In order to improve your chances for finding a match to the Avatar, name your bones in a way that reflects the body parts they represent (names like “LeftArm”, “RightForearm” are suitable here).
If the model does NOT yield a valid match, you can manually follow a similar process to the one used internally by Mecanim:-
- (try to get the model closer to the pose with which it was modelled, a sensible initial pose)
- (create a bone-mapping from an initial pose)
- (force the model closer to T-pose, which is the default pose used by Mecanim animations)
If the auto-mapping (Scene or from theHierarchy. If Mecanim thinks a bone fits, it will show up as green in the Avatar Inspector, otherwise it shows up in red. ) fails completely or partially, you can assign bones by either draging them from the
Finally, if the bone assignment is correct, but the character is not in the correct pose, you will see the message “Character not in T-Pose”. You can try to fix that with or rotate the remaining bones into T-pose.
Avatar Body Masks
Sometimes it is useful to restrict an animation to specific body parts. For example, an walking animation might involve the character swaying his arms but if he picks up a gun, he should hold it in front of him. You can use an Avatar Body Mask to specify which parts of a character an animation should be restricted to.
Muscle setup
Mecanim allows you to control the range of motion of different bones using Muscles.
Once the Avatar has been properly configured, Mecanim will “understand” the bone structure and allow you to start working in the Muscles tab of the Avatar Inspector. Here, it is very easy to tweak the character’s range of motion and ensure the character deforms in a convincing way, free from visual artifacts or self-overlaps.
You can either adjust individual bones in the body (lower part of the view) or manipulate the character using predefined deformations which operate on several bones at once (upper part of the view).
Muscle Clips
In the Animation tab, you can set up Muscle Clips, which are animations for specific muscles and muscle groups.
You can also define which body parts these muscle clips apply to.
No comments:
Post a Comment