Friday, 1 August 2014

Animation From Character to Player in Unity.

The Video Link below shows the How we would export and rig a Model and animate it in 3rd person.

                  http://www.youtube.com/watch?v=nsS5qfn6E6A&feature=youtu.be

Thursday, 31 July 2014

Animator View

To do this,first click the Window tab and then select animation



Like any other view,it is resizeable,movable and rotatable,the add curve button can be expanded to view more options


To add Curve,click the + sign you wish to add a curve. Since we want the camera to fly around the scene,we would want a add position and rotation



The timeline is where we can established the timing of our animation. it is measured in frames and seconds. The red scrubber allows us to choose which to modify

To edit, simply click on the frame which we want to modify, and then move the camera position to where we want it
You will then notice there is a key frame that is added into the timeline with the appropriate values







Wednesday, 30 July 2014

Animator Scripting\



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.

Avatar Mask



Specific body parts can be selectively enabled or disabled in an animation using a so-called Body Mask. Body masks are used in the Animation tab of the mesh import inspector and Animation Layers. Body masks enable you to tailor an animation to fit the specific requirements of your character more closely. For example, you may have a standard walking animation that includes both arm and leg motion, but if a character is carrying a large object with both hands then you wouldn’t want his arms to swing by his sides as he walks. However, you could still use the standard walking animation by switching off the arm movements in the body mask.
The body parts included are: Head, Left Arm, Right Arm, Left Hand, Right Hand, Left Leg, Right Leg and Root (which is denoted by the “shadow” under the feet). In the body mask, you can also toggle inverse kinematics (IK) for hands and feet, which will determine whether or not IK curves will be included in animation blending.
Click the avatar section to toggle inclusion or exclusion (green/red)
Double click in empty space surrounding the avatar to toggle all


Body mask in the Body Mask inspector (arms excluded)
In the Animation tab of the mesh import inspector, you will see a list entitled Clips that contains all the object’s animation clips. When you select an item from this list, options for the clip will be shown, including the body mask editor.
You can also create Body Mask Assets (Assets->Create->Avatar Body Mask), which show up as .mask files on disk.
The BodyMask assets can be reused in Animator Controllers, when specifying Animation Layers
A benefit of using body masks is that they tend to reduce memory overheads since body parts that are not active do not need their associated animation curves. Also, the unused curves need not be calculated during playback which will tend to reduce the CPU overhead of the animation.

Animation Layers
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-Curves and Events
"I DON'T HAVE CURVE IN MY UNITY,BUT I WILL TRY TO EXPLAIN IT HERE"

Animation curves can be attached to animation clips in the Animations tab of the Animation Import Settings.

The curve’s X-axis represents normalized time and always ranges between 0.0 and 1.0 (corresponding to the beginning and the end of the animation clip respectively, regardless of its duration).


Double-clicking an animation curve will bring up the standard Unity curve editor (see Editing Value Properties for further details) which you can use to add keys to the curve. Keys are points along the curve’s timeline where it has a value explicitly set by the animator rather than just using an interpolated value. Keys are very useful for marking important points along the timeline of the animation. For example, with a walking animation, you might use keys to mark the points where the left foot is on the ground, then both feet on the ground, right foot on the ground, etc. Once the keys are set up, you can move conveniently between key frames by pressing the Previous/Next Key Frame buttons. This will move the vertical red line and show the normalized time at the keyframe; the value you enter in the text box will then set the value of the curve at that time.

If you have a curve with the same name as one of the parameters in the Animator Controller, then that parameter will take its value from the value of the curve at each point in the timeline. For example, if you make a call to GetFloat from a script, the returned value will be equal to the value of the curve at the time the call is made. Note that at any given point in time, there might be multiple animation clips attempting to set the same parameter from the same controller. In that case, the curve values from the multiple animation clips are blended. If an animation has no curve for a particular parameter then the blending will be done with the default value for that parameter.



Animation Events



The power of animation clips can be increased by using Animation Events, which allow you to call functions in the object’s script at specified points in the timeline.

The function called by an animation event can optionally take one parameter. The parameter can be a float, string, int, object reference or an AnimationEvent object. The AnimationEvent object has member variables that allow a float, string, integer and object reference to be passed into the function all at once, along with other information about the event that triggered the function call.


You can add an animation event to a clip at the current play head position by clicking the Event button or at any point in the animation by double-clicking the Event Line at the point where you want the event to be triggered. Once added, an event can be re positioned by dragging with the mouse. You can delete an event by selecting it and pressing Delete, or by right-clicking on it and selecting Delete Event from the contextual menu.

Animation Events are shown in the Event Line. Add a new Animation Event by double-clicking the Event Line or by using the Event button.
When you add an event, a dialog box will appear to prompt you for the name of the function and the value of the parameter you want to pass to it.

The Animation Event popup dialog lets you specify which function to call with which parameter value.
The events added to a clip are shown as markers in the event line. Holding the mouse over a marker will show a tooltip with the function name and parameter value.


Holding the mouse cursor over an Animation Event marker will show which function it calls as well as the parameter value.