Chase camera

The Chase Camera demo demonstrates a type of third-person locomotion in a VR environment. The player can direct a character around the scene using the pointer. For short distances, the camera will remain still. For longer distances, the camera will follow behind the main character. Chase Camera also uses tunneling for horizontal and rotational movements to reduce motion sickness.

Getting started

Adding Chase Camera to your scene requires two things:

  1. Drag the ChaseCamPlayer Prefab into your scene.
  2. Assign the Chase Character property to the main character.

Customization

Chase Camera is designed to be customized. You can adjust the camera controls, the pointer and target visualization, and the main character to meet your app's needs.

Camera controls

ChaseCamPlayer manages camera behavior and is configured with a default camera configuration. It offers a number of settings you can customize to your use case.

  • Bounding Radius: Movement within the Bounding Radius will not cause the camera to move.
  • Trailing Offset: The offset the camera will try to maintain from the chase character. If the character moves outside the bounding radius, the camera will animate with the character to maintain this offset position.
  • Movement Speed: The speed of the camera when it respositions itself when the chase character moves outside the bounding radius.
  • Rotation: You can optionally disable rotation through a checkbox on the component. It is controlled by 2 triggers (left and right rotate).

Pointer and target visualization

The Chase Camera demo comes with a pointer system for directing the main character around the scene. This is optional can be customized in ChaseCamPlayer/Pointer/Laser. You can adjust the Target Prefab property to change the target at the end of the laser. You can also adjust the laser colors.

You can also create your own pointer system, as long as you call into SetTargetPosition() on the BasePositionedCharacter. Calling this method internally notifies the chase camera to follow the character.

Main character

The Chase Camera demo comes with its own character that can be further customized or even swapped out. For characters that use CharacterController and move about on the ground, you can can subclass GroundPositionCharacter. If your character doesn't use CharacterController or you don't want them to be acted on by gravity, such a flying character, you can subclass the more general BasePositionCharacter class instead.

For an example you can look at FoxPositionCharacter, the class that controls the provided fox character. Note that the only additional information this subclass as over GroundPositionCharacter is the animations associated with the fox.