Once you have rigged your character in mixamo, export it onto unity in .fbx
Once on Unity Make you have for an asset a Sample Asset. If you don't it available for unity 4.3 or higher at the asset store.
if you already have you may proceed.
Now go to Sample Assets > Characters > Third Person Character > Prefab
In the Third Person Character folder you'll find two ready-made character prefabs, which are used in the third person character sample scenes. These prefabs demonstrate how you can use the third person characters scripts and animations we've included, including an AI-controlled variant which is able to walk towards a specified target, or follow a waypoint-based route.
The simplest way to get started setting up your own character is to take our Third Person Character and replace the art with your own model. To do so, make sure you've imported your own rigged model with a Humanoid avatar, then follow these steps:
1) Start with a suitable scene. There ought to be enough flat ground to walk around on.
2) Place the "Third Person Character" prefab in the scene.
3) Unfold the Third Person Character hierarchy in the hierarchy window, and delete the "Ethan" child object.
4) Place your own character model as a child of the Third Person Character, in place of Ethan.
5) Make sure your character model's position in the inspector is set to zero on X and Z, and that it's Y position is appropriately adjusted so that your character's feet are at the same position as the Third Person Character GameObject. (if you find it easier, you could add your character first before deleting Ethan, so that you can use Ethan's feet as a guide for where your character's feet should be)
7) Hit play, and try controlling your character!
You'll probably want to add a camera rig so that the camera follows the character as it runs off. See the Camera Rig guidelines for instructions on how to do that.
The Third Person Character script exposes a number of properties which determine the jump power, the amount of control while in air, and various other speed and behaviour modifiers. For more detail about each setting, see the comments in the script.
The ThirdPersonUserControl script takes input from the "CrossPlatformInput" class included in the sample assets, however if you're not targeting mobile or prefer to use a different system to read input, you can simply use Unity's built-in Input class in place of CrossPlatformInput. For more information, see the Cross Platform Input guidelines.
The sample scenes provided works on standalone and also include cross platform touch controls which are set up and ready to publish to mobile.
The ThirdPersonAIControl component can be added instead of the user control component, allowing the character to be AI controlled. This relies on a NavMeshAgent to pathfind the way to the target. The NavMeshAgent should be a child object of the Character, as demonstrated in the AI Character Prefab provided. If you want to create your own AI characters, you can follow the steps above, but start with the AI prefab we provided.
The Wheel Collider is a special collider for grounded vehicles. It has built-in collision detection, wheel physics, and a slip-based tire friction model. It can be used for objects other than wheels, but it is specifically designed for vehicles with wheels.
PROPERTIES
Center
Center of the wheel in object local space.
Radius
Radius of the wheel.
Suspension Distance
Maximum extension distance of wheel suspension, measured in local space. Suspension always extends downwards through the local Y-axis.
Suspension Spring
The suspension attempts to reach a Target Position by adding spring and damping forces.
Spring
Spring force attempts to reach the Target Position. A larger value makes the suspension reach the Target Position faster.
Damper
Dampens the suspension velocity. A larger value makes the Suspension Spring move slower.
Target Position
The suspension's rest distance along Suspension Distance. 0 maps to fully extended suspension, and 1 maps to fully compressed suspension. Default value is zero, which matches the behavior of a regular car's suspension.
Mass
The Mass of the wheel.
Forward/Sideways Friction
Properties of tire friction when the wheel is rolling forward and sideways.
Colliders are another kind of component that must be added alongside the Rigidbody in order to allow collisions to occur. If two Rigidbodies bump into each other, the physics engine will not calculate a collision unless both objects also have a Collider attached. Collider-less Rigidbodies will simply pass through each other during physics simulation.
Add a Collider with the Component->Physics menu. View the Component Reference page of any individual Collider for more specific information:
Types Of Colliders :
1) Box Collider - primitive shape of a cube2) Sphere Collider - primitive shape of a sphere 3) Capsule Collider - primitive shape of a capsule 4) Mesh Collider - creates a collider from the object's mesh, cannot collide with another Mesh Collider 5) Wheel Collider - specifically for creating cars or other moving vehicles
Box Collider
The Box Collider is a basic cube-shaped collision primitive.
PROPERTIES Material Reference to the Physic Material that determines how this Collider interacts with others. IsTrigger If enabled, this Collider is used for triggering events, and is ignored by the physics engine. Size The size of the Collider in the X, Y, Z directions. Center The position of the Collider in the object's local space.
Sphere Collider
The Sphere Collider is a basic sphere-shaped collision primitive.
PROPERTIES
Material Reference to the Physic Material that determines how this Collider interacts with others. IsTrigger If enabled, this Collider is used for triggering events, and is ignored by the physics engine. Radius The size of the Collider. Center The position of the Collider in the object's local space.
Capsule Collider
The Capsule Collider is made of two half-spheres joined together by a cylinder. It is the same shape as the Capsule primitive.
PROPERTIES
Material Reference to the Physic Material that determines how this Collider interacts with others. Is Trigger If enabled, this Collider is used for triggering events, and is ignored by the physics engine. Radius The radius of the Collider's local width. Height The total height of the Collider. Direction The axis of the capsule's lengthwise orientation in the object's local space. Center The position of the Collider in the object's local space
Mesh Collider
The Mesh Collider takes a Mesh Asset and builds its Collider based on that mesh. It is far more accurate for collision detection than using primitives for complicated meshes. Mesh Colliders that are marked as Convex can collide with other Mesh Colliders.
PROPERTIES
Material Reference to the Physic Material that determines how this Collider interacts with others. Is Trigger If enabled, this Collider is used for triggering events, and is ignored by the physics engine. Mesh Reference to the Mesh to use for collisions. Smooth Sphere Collisions When this is enabled, collision mesh normals are smoothed. You should enable this on smooth surfaces eg. rolling terrain without hard edges to make sphere rolling smoother. Convex If enabled, this Mesh Collider will collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles.
Unity’s Animation System allows you to create beautifully animated skinned characters. The Animation System supports animation blending, mixing, additive animations, walk cycle time synchronization, animation layers, control over all aspects of the animation playback (time, speed, blend-weights), mesh skinning with 1, 2 or 4 bones per vertex as well as supporting physically based rag-dolls and procedural animation. To obtain the best results, it is recommended that you read about the best practices and techniques for creating a rigged character with optimal performance in Unity on the Modeling Optimized Characters page.
Making an animated character involves two things; moving it through the world and animating it accordingly. If you want to learn more about moving characters around, take a look at the Character Controller page. This page focuses on the animation. The actual animating of characters is done through Unity’s scripting interface.
The Animation View can be used to preview and edit Animation Clips for animated Game Objects in Unity. The Animation View can be opened from the Window->Animation menu.
Viewing Animations on a GameObject
The Animation View is tightly integrated with the Hierarchy View, the Scene View, and the Inspector. Like the Inspector, the Animation View will show whatever Game Object is selected. You can select a Game Object to view using the Hierarchy View or the Scene View. (If you select a Prefab in the Project View you can inspect its animation curves as well, but you have to drag the Prefab into the Scene View in order to be able to edit the curves.)
At the left side of the Animation View is a hierarchical list of the animatable properties of the selected Game Object. The list is ordered by the Components and Materials attached to the Game Object, just like in the Inspector. Components and Materials can be folded and unfolded by clicking the small triangles next to them. If the selected Game Object has any child Game Objects, these will be shown after all of the Components and Materials.
Creating a New Animation Clip
Animated Game Objects in Unity need an Animation Component that controls the animations. If a Game Object doesn’t already have an Animation Component, the Animation View can add one for you automatically when creating a new Animation Clip or when entering Animation Mode.
To create a new Animation Clip for the selected Game Object, click the right of the two selection boxes at the upper right of the Animation View and select [Create New Clip]. You will then be prompted to save an Animation Clip somewhere in your Assets folder. If the Game Object doesn't have an Animation Component already, it will be automatically added at this point. The new Animation Clip will automatically be added to the list of Animations in the Animation Component.
In the Animation View you can always see which Game Object you are animating and which Animation Clip you are editing. There are two selection boxes in the upper left of the Animation View. The left selection box shows the Game Object with the Animation Component attached, and the right selection box shows the Animation Clip you are editing.
Animating a Game Object
To begin editing an Animation Clip for the selected Game Object, click on the Animation Mode button.
This will enter Animation Mode, where changes to the Game Object are stored into the Animation Clip. (If the Game Object doesn’t have anAnimation Component already, it will be automatically added at this point. If there is not an existing Animation Clip, you will be prompted to save one somewhere in your Assets folder.)
You can stop the Animation Mode at any time by clicking the Animation Mode button again. This will revert the Game Object to the state it was in prior to entering the Animation Mode.
You can animate any of the properties shown in the property list of the Animation View. To animate a property, click on the Key Indicator for that property and choose Add Curve from the menu. You can also select multiple properties and right click on the selection to add curves for all the selected properties at once. (Transform properties are special in that the .x, .y, and .z properties are linked, so that curves are added three at a time.)
When in Animation Mode, a red vertical line will show which frame of the Animation Clip is currently previewed. The Inspector and Scene View will show the Game Object at that frame of the Animation Clip. The values of the animated properties at that frame are also shown in a column to the right of the property names.
You can click anywhere on the Time Line to preview or modify that frame in the Animation Clip. The numbers in the Time Line are shown as seconds and frames, so 1:30 means 1 second and 30 frames.
You can also use the following keyboard shortcuts to navigate between frames:
Press Comma (,) to go to the previous frame.
Press Period (.) to go to the next frame.
Hold Alt and press Comma (,) to go to the previous key frame.
Hold Alt and press Period (.) to go to the next key frame.
In Animation Mode you can move, rotate, or scale the Game Object in the Scene View. This will automatically create Animation Curves for the position, rotation, and scale properties of the Animation Clip if they didn’t already exist, and keys on those Animation Curves will automatically be created at the currently previewed frame to store the respective Transform values you changed.
You can also use the Inspector to modify any of the animatable properties of the Game Object. This too will create Animation Curves as needed, and create keys on those Animation Curves at the currently previewed frame to store your changed values. Properties that are not animatable are grayed out in the Inspector while in Animation Mode.
You can also manually create a keyframe using the Keyframe button. This will create a key for all the curves that are currently shown in the Animation View. If you want to only show curves for a subset of the properties in the property list, you can select those properties. This is useful for selectively adding keys to specific properties only.
Playback
The Animation Clip can be played back at anytime by clicking the Play button in the Animation View.
The playback will loop within the time range that is shown in the Time Line. This makes it possible to focus on refining a small part of the Animation Clip that is being worked on, without having to play back the entire length of the clip. To play back the whole length of the Animation Clip, zoom out to view the entire time range, or press F to Frame Select with no keys selected.
Using the inspector comes in three parts , Model ,Rig and Animation. Today we'll be looking at Animations.
The ”position”,”rotation” and ”scale” error will allow us to get the position if its with a smaller value.and the less compression that we will get.
The clips section will show you what animation you have in the model.
When one of this clips are selected, all of the option for that specific clip are available.
Below the timeline is the loop pose.
If the loop pose is checked,unity will try and mesh the start and the end to make it look smoother.The cycle offset is for mirroring animation.If the bake into pose is checked, the avatar will not rotate with any turning within the animation.Used this if the animation is running in a straight line so that any deviation from a straight line is not affected,the root transform rotation can either be based on the body orientation at the start of the animation or the original source file of the animation.As with root transformation,
if checked in the bake into pose,the avatar will not move up or down in the animation. There is a few that it can be based on. Original takes from the original file.Otherwise it can be based on the avatar's center of mass or its feet.
Unity uses Animation Layers for managing complex state machines for different body parts. An example of this is if you have a lower-body layer for walking-jumping, and an upper-body layer for throwing objects / shooting.
You can manage animation layers from the Layers Widget in the top-left corner of the Animator Controller.
You can add a new layer by pressing the + on the widget. On each layer, you can specify the body mask (the part of the body on which the animation would be applied), and the Blending type. Override means information from other layers will be ignored, while Additive means that the animation will be added on top of previous layers.
The Mask property is there to specify the body mask used on this layer. For example if you want to use upper body throwing animations, while having your character walk or run, you would use an upper body mask, like this:
Animation Layer syncing
Sometimes it is useful to be able to re-use the same state machine in different layers. For example if you want to simulate “wounded” behavior, and have “wounded” animations for walk / run / jump instead of the “healthy” ones. You can click the Sync check box on one of your layers, and then select the layer you want to sync with. The state machine structure will then be the same, but the actual animation clips used by the states will be distinct.
In an Animation Clip, any animatable property can have an Animation Curve, which means that the Animation Clip controls that property. In the property list of the Animation View properties with Animation Curves have colored curve indicators. For information on how to add curves to an animation property.
A Game Object can have quite a few components and the property list in the Animation View can get very long. To show only the properties that have Animation Curves, click the lower left button in the Animation View to set its state to Show: Animated.
Understanding Curves, Keys and Keyframes
An Animation Curve has multiple keys which are control points that the curve passes through. These are visualized in the Curve Editor as small diamond shapes on the curves. A frame in which one or more of the shown curves have a key is called a keyframe. The keyframes are shown as white diamonds in the Keyframe Line.
If a property has a key in the currently previewed frame, the curve indicator will have a diamond shape.
The Keyframe Line only shows keyframes for the curves that are shown. If a property is selected in the property list, only that property is shown, and the Keyframe Line will not mark the keys of the curves that are not shown.
Adding and Moving Keyframes
The Keyframe Line shows the keyframes of the currently shown curves. You can add a keyframe by double-clicking the Keyframe Line or by using the Keyframe button.
A keyframe can be added at the currently previewed frame by clicking the Keyframe button or at any given frame by double-clicking the Keyframe Line at the frame where the keyframe should be. This will add a key to all the shown curves at once. It is also possible to add a keyframe by right-clicking the Keyframe Line and select Add Keyframe from the context menu. Once placed, keyframes can be dragged around with the mouse. It is also possible to select multiple keyframes to drag at once. Keyframes can be deleted by selecting them and pressing Delete, or by right-clicking on them and selecting Delete Keyframe from the context menu.
Wrap Mode
An Animation Clip in Unity can have various Wrap Modes that can for example set the Animation Clip to loop. See WrapMode in the Scripting Reference to learn more. The Wrap Mode of an Animation Clip can be set in the Animation View in the lower right selection box. The Curve Viewwill preview the selected Wrap Mode as white lines outside of the time range of the Animation Clip.
Setting the Wrap Mode of an Animation Clip will preview that Wrap Mode in the Curve View.
Supported Animatable Properties
The Animation View can be used to animate much more than just the position, rotation, and scale of a Game Object. The properties of anyComponent and Material can be animated - even the public variables of your own scripts components. Making animations with complex visual effects and behaviors is only a matter of adding Animation Curves for the relevant properties.
The following types of properties are supported in the animation system:
Float
Color
Vector2
Vector3
Vector4
Quaternion
Arrays are not supported and neither are structs or objects other than the ones listed above.
Booleans in script components are not supported by the animation system, but booleans in certain built-in components are. For those booleans, a value of 0 equals False while any other value equals True.
Here are a few examples of the many things the Animation View can be used for:
Animate the Color and Intensity of a Light to make it blink, flicker, or pulsate.
Animate the Pitch and Volume of a looping Audio Source to bring life to blowing wind, running engines, or flowing water while keeping the sizes of the sound assets to a minimum.
Animate the Texture Offset of a Material to simulate moving belts or tracks, flowing water, or special effects.
Animate the Emit state and Velocities of multiple Ellipsoid Particle Emitters to create spectacular fireworks or fountain displays.
Animate variables of your own script components to make things behave differently over time.
When using Animation Curves to control game logic, please be aware of the way animations are played back and sampled in Unity.
Rotation Interpolation Types
In Unity rotations are internally represented as Quaternions. Quaternions consist of .x, .y, .z, and .w values that should generally not be modified manually except by people who know exactly what they’re doing. Instead, rotations are typically manipulated using Euler Angles which have .x, .y, and .z values representing the rotations around those three respective axes.
When interpolating between two rotations, the interpolation can either be performed on the Quaternion values or on the Euler Angles values. TheAnimation View lets you choose which form of interpolation to use when animating Transform rotations. However, the rotations are always shown in the form of Euler Angles values no matter which interpolation form is used.
Quaternion Interpolation
Quaternion interpolation always generates nice interpolations along the shortest path between two rotations. This avoids rotation interpolation artifacts such as Gimbal Lock. However, Quaternion interpolation cannot represent rotations larger than 180 degrees, because it is then shorter to go the other way around. If you use Quaternion interpolation and place two keys further apart than 180 degrees, the curve will look discontinuous, even though the actual rotation is still smooth - it simply goes the other way around, because it is shorter. If rotations larger than 180 degrees are desired, additional keys must be placed in between. When using Quaternion interpolation, changing the keys or tangents of one curve may also change the shapes of the other two curves, since all three curves are created from the internal Quaternion representation. When using Quaternion interpolation, keys are always linked, so that creating a key at a specific time for one of the three curves will also create a key at that time for the other two curves.
Euler Angles Interpolation
Euler Angles interpolation is what most people are used to working with. Euler Angles can represent arbitrary large rotations and the .x, .y, and .zcurves are independent from each other. Euler Angles interpolation can be subject to artifacts such as Gimbal Lock when rotating around multiple axes at the same time, but are intuitive to work with for simple rotations around one axis at a time. When Euler Angles interpolation is used, Unity internally bakes the curves into the Quaternion representation used internally. This is similar to what happens when importing animation into Unity from external programs. Note that this curve baking may add extra keys in the process and that tangents with the Constant tangent type may not be completely precise at a sub-frame level.
Editing Curves
Curves can be used for many different things and there are several different controls in Unity that use curves that can be edited.
The Animation View uses curves to animate properties over time in an Animation Clip.
Script components can have member variables of type Animation Curve that can be used for all kinds of things. Clicking on those in the Inspector will open up the Curve Editor.
The Audio Source component uses curves to control rolloff and other properties as a function of distance to the Audio Source.
While these controls have subtle differences, the curves can be edited in the exact same way in all of them. This page explains how to navigate and edit curves in those controls.
Adding and Moving Keys on a Curve
A key can be added to a curve by double-clicking on the curve at the point where the key should be placed. It is also possible to add a key by right-clicking on a curve and select Add Key from the context menu.
Once placed, keys can be dragged around with the mouse:
Click on a key to select it. Drag the selected key with the mouse.
To snap the key to the grid while dragging it around, hold down Command on Mac / Control on Windows while dragging.
It is also possible to select multiple keys at once:
To select multiple keys at once, hold down Shift while clicking the keys.
To deselect a selected key, click on it again while holding down Shift.
To select all keys within a rectangular area, click on an empty spot and drag to form the rectangle selection.
The rectangle selection can also be added to existing selected keys by holding down Shift.
Keys can be deleted by selecting them and pressing Delete, or by right-clicking on them and selecting Delete Key from the context menu.
Navigating the Curve View
When working with the Animation View you can easily zoom in on details of the curves you want to work with or zoom out to get the full picture.
You can always press F to frame-select the shown curves or selected keys in their entirely.
Zooming
You can zoom the Curve View using the scroll-wheel of your mouse, the zoom functionality of your trackpad, or by holding Alt while right-dragging with your mouse.
You can zoom on only the horizontal or vertical axis:
zoom while holding down Command on Mac / Control on Windows to zoom horizontally.
zoom while holding down Shift to zoom vertically.
Furthermore, you can drag the end caps of the scrollbars to shrink or expand the area shown in the Curve View.
Panning
You can pan the Curve View by middle-dragging with your mouse or by holding Alt while left-dragging with your mouse.
Editing Tangents
A key has two tangents - one on the left for the ingoing slope and one on the right for the outgoing slope. The tangents control the shape of the curve between the keys. The Animation View have multiple tangent types that can be used to easily control the curve shape. The tangent types for a key can be chosen by right-clicking the key.
In order for animated values to change smoothly when passing a key, the left and right tangent must be co-linear. The following tangent types ensure smoothness:
Auto: The tangents are automatically set so make the curve go smoothly through the key.
Free Smooth: The tangents can be freely set by dragging the tangent handles. They are locked to be co-linear to ensure smoothness.
Flat: The tangents are set to be horizontal. (This is a special case of Free Smooth.)
Sometimes smoothness is not desired. The left and right tangent can be set individually when the tangents are Broken. The left and right tangent can each be set to one of the following tangent types:
Free: The tangent can be freely set by dragging the tangent handle.
Linear: The tangent points towards the neighboring key. A linear curve segment can be made by setting the tangents at both ends to be Linear.
Constant: The curve retains a constant value between two keys. The value of the left key determines the value of the curve segment.