Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unity3D Animation. The Animation System supports –animation blending, –mixing, –additive animations, –walk cycle time synchronization, –animation layers,

Similar presentations


Presentation on theme: "Unity3D Animation. The Animation System supports –animation blending, –mixing, –additive animations, –walk cycle time synchronization, –animation layers,"— Presentation transcript:

1 Unity3D Animation

2 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.

3 AnimationClip Stores keyframe based animations. length Animation length in seconds (Read Only)length frameRate Frame rate at which keyframes are sampled (Read Only)frameRate wrapMode Sets the default wrap mode used in the animation state.wrapMode

4 WrapMode Once –When time reaches the end of the animation clip, the clip will automatically stop playing. Loop –When time reaches the end of the animation clip, time will continue at the beginning. PingPong –When time reaches the end of the animation clip, time will ping pong back between beginning and end. Default –Reads the default repeat mode set higher up. ClampForever –Plays back the animation. When it reaches the end, it will keep playing the last frame and never stop playing.

5 AnimationState In most cases the Animation interface is sufficient and easier to use.Animation Variables –enabled Enables / disables the animation.enabled –weight The weight of animationweight –wrapMode Wrapping mode of the animation.wrapMode –time The current time of the animationtime –normalizedTime The normalized time of the animation.normalizedTime –speed The playback speed of the animation. 1 is normal playback speed.speed –normalizedSpeed The normalized playback speed.normalizedSpeed –length The length of the animation clip in seconds.length –layer The layer of the animation. When calculating the final blend weights, animations in higher layers will get their weightslayer –clip The clip that is being played by this animation state.clip –name The name of the animationname –blendMode Which blend mode should be used?blendMode

6 Animation Blending Void Update() { If(Input.GetAxis(“Vertical”) > 0.2f) { animation.CrossFade(“walk”); }else { animation.CrossFade(“idle”); }

7 Animation Layers Void Start () { animation.wrapMode = WrapMode.Loop; animation["shoot"].wrapMode = WrapMode.Once; animation["shoot"].layer = 1; animation.Stop(); }

8 Animation Mixing void Start () { Transform mixTransform; mixTransform = transform.Find("root/upper_body/left_shoulder"); animation["wave_hand"].AddMixingTransform(mixTransform); }

9 Using Animation Events function PrintFloat (theValue : float) { Debug.Log ("PrintFloat is called with a value of " + theValue); } 1 2 3

10 Additive Animation Example private var leanLeft : AnimationState; private var leanRight : AnimationState; function Start () { leanLeft = animation["leanLeft"]; leanRight = animation["leanRight"]; leanLeft.layer = 10; leanRight.layer = 10; leanLeft.blendMode = AnimationBlendMode.Additive; leanRight.blendMode = AnimationBlendMode.Additive; // 하략 } function Update () { var lean = Input.GetAxis("Horizontal"); leanLeft.normalizedTime = -lean; leanRight.normalizedTime = lean; }

11 Modeling Optimized Characters Use one Skinned Mesh Renderer –Your character should use only a single skinned mesh renderer.skinned mesh renderer Don't Use Many Materials –You also want to keep the number of materials on that mesh as low as possible.materials Reduce Amount of Bones –Medium Desktop games use bone hierarchies with 15-60 bones. The fewer bones you use the faster; with 30 bones you can achieve very good quality on Desktop platforms and fairly good quality on Mobile Platforms.. Polygon Count –How many polygons you should use depends on the quality you require and the platform you are targeting. Anything between 300-1500 triangles on Mobile Platforms and 500-6000 triangles on Desktop Platforms is reasonable. Separate Out IK and FK –Separate out inverse kinematics (IK) and forward kinematics (FK). When animations are imported, the IK nodes are baked into FK, thus Unity doesn't need the IK nodes at all. Use Reusable Rigs –Create a rig which you can reuse. This allows you to share animations between different characters. Name Bones Correctly –Name the bones correctly (left hip, left ankle, left foot etc.). Especially with characters, naming your bones correctly is very important.

12 Quality


Download ppt "Unity3D Animation. The Animation System supports –animation blending, –mixing, –additive animations, –walk cycle time synchronization, –animation layers,"

Similar presentations


Ads by Google