Animations Part 2

Download

Unity Cheat Sheet: #24

Abhishek Smith

Abhishek Smith

Building Outscal | Land Jobs in the gaming industry | EA, Epic Games, TCS, | CMU, IIT K

Animation in Unity isn't just about playing and stopping animations. It's a complete system for controlling character movement, blending animations, and creating complex behaviours.

Core Animation Controls:

  • Play/Stop: Basic playback controls
  • SetBool/SetTrigger/SetFloat: Tell animator when to change states
  • GetBool/GetTrigger: Check current animation conditions
  • Speed: Control animation playback speed

Animation Clips:

  • Add/Remove clips at runtime
  • Set frameRate for timing control
  • Legacy vs Mecanim system compatibility
  • AddClip for dynamic animation loading

Animation Events:

  • Trigger functions at specific animation frames
  • Set exact time for event triggers
  • Useful for footsteps, attack hits, sound effects
  • Add custom function calls during animations

Inverse Kinematics (IK):

  • SetIKPosition: Place hands/feet precisely
  • SetIKRotation: Control limb orientation
  • SetIKPositionWeight: Blend between IK and animation
  • Essential for dynamic interaction with environment

Animation Layers:

  • SetLayerWeight: Control animation mixing
  • CrossFade: Smooth transitions between states
  • Multiple animations playing simultaneously
  • Blend different body parts independently

Root Motion:

  • ApplyRootMotion: Use animation for character movement
  • DeltaPosition: Get movement from animation
  • Essential for realistic character locomotion
  • Handles complex movement animations

Remember:

  • Animator Controller handles state management
  • Animation Events for precise timing
  • IK for environmental interaction
  • Layers for complex animation mixing
  • Root Motion for animation-driven movement

Show More