Skip to main content

Overview

Character Animation System features a simple camera component that supports:
  • First- and third-person views.
  • Camera stabilization in first-person mode.
  • Camera shakes.
  • Smooth FOV updates.

Inputs

Input properties to control the camera.
  • Yaw and Pitch Input — horizontal and vertical input values.
  • Is Aiming — whether player is aiming.
  • Is Crouching — whether player is crouching or standing.
  • Is First Person — defines current view mode.
  • Use Right Shoulder — defines anchor shoulder.
  • View Smoothing — interpolation speed.

Transforms

Source transforms.
  • First Person Socket — camera will follow this transform when in first-person.
  • Camera Animation Source — animated transform that will be used to animate camera.

Offsets

Camera offsets for different situations.
Camera offsets are represented as struct properties:
  • Offset — position offset relative to the pivot point.
  • Pivot — pivot point offset relative to the origin.
Tip: Character Camera uses player transform as origin

Camera Collision

Tracing properties to avoid camera clipping with obstacles.
  • Trace Radius — sphere trace radius.
  • Trace Interp Speed — camera smoothing speed when adjusting for collision.
  • Trace Mask — what collision layers will be used.

FOV

Use this method to update target field-of-view:
CharacterCamera.cs

Camera Shakes

Shakes are fire-and-forget type of motions that can are played at runtime to simulate hits or recoil:
  • X — rotation motion around X axis.
  • Y — rotation motion around Y axis.
  • Z — rotation motion around Z axis.
  • Pitch, Yaw Roll — Vector4 shake value range.
  • Play Rate — playback speed multiplier.
  • Smooth Speed — interpolation speed.
Tip: A shake value is computed as a random between Mathf.Random(ragne.x, range.y) and Mathf.Random(range.z, range.w).
Use this function to play camera shakes from code:
CharacterCamera.cs