πŸ”ΉCharacter Camera

This page explains how camera is animated in CAS.

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.

circle-check

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:

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.

circle-info

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:

Last updated