🎥Camera Follower

Simple system to follow objects and do Shake/FOV effects, wokrs with Cinemachine by default.

How it works

You can find prefab in _Main\Prefabs\Common\CameraCustom\CameraHolder.prefab

Structure in prefab
How it's structures runtime (you can unparent MainCamera in scene)

"CameraHolder" object is holder of Camera custom system. "Camera [parent]" object is additional layer for Object shake. CameraHolder moves camera parent in POV change operations and it's posible to do shake while POV changing. Holder has MainCamera object reference (camera itself with Cinemachine brain on it) and Main Virtual Camera is Cinemachine virtual camera.

Inspector variables
  • Follow Target -> what should CameraHolder follow

  • Copy Follow Target Rotation -> should CameraHolder follow target object rotation too?

  • Follow Position Lerp -> how fast will CameraHolder follow to target object position less value -> more time needs to reach target completely

  • Follow Rotation Lerp -> the same as Follow Position Lerp but for rotation (has no effect if Copy Follow Target Rotation set to false)

  • Change POV Pos/Rot curves controlles how POV MainCamera local Pos/Rot with change from one to another (interpolates from 0 to 1)

  • Camera POV_s -> core component to switch "Camera [parent]" object local Pos+Rot by POV (point of view) name or array index. MainCamera replaced under Camera [parent] so we can freely change Camera [parent] local Pos+Rot and Camera POV_s is array of point of views (states).

  • Change Target Position/Rotation curves -> controlles how Camera (holder) Pos/Rot with change from current Camera (holder) point to new Follow Target point (interpolates from 0 to 1).

EDITOR TOOLS

  • POV index -> current selected editor Camera POV_s index to perform operations: - Preview POV (toggle it on and "Camera [parent]" transform will set to POV index from Camera POV_s array) - Refresh POV index (button) -> refreshes POV from Camera POV_s array by POV index. Values will be taken from "Camera [parent]" current transform values.

  • Add POV to end (button) -> creates POV by taking current "Camera [parent]" transform values and adds it to the end of Camera POV_s

Connected modules

Camera Custom uses Object Shake and CameraFOVHandler. They can be accessed by CameraFollower instance -> ShakeEffect and CameraFOVHandler properties. more API -> see script CameraFollower.

Example of Camera Custom can be found here: _Examples\Camera Custom\Example.scene

Last updated