Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / CameraRigComponent

Class: CameraRigComponent ​

Defined in: components/CameraRig.ts:28

Makes the camera it's on follow an entity. Add it to the camera entity and pick a target; there's nothing to script. Fields left null take the usual value for the mode.

Set mode at runtime to switch view, and the camera eases to the new one over blendTime. Cutscenes go through this.cameras, and control comes back here when they end.

Extends ​

Constructors ​

Constructor ​

ts
new CameraRigComponent(options?): CameraRigComponent;

Defined in: components/CameraRig.ts:77

Parameters ​

ParameterType
optionsCameraRigOptions

Returns ​

CameraRigComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDefault valueDescriptionDefined in
enabledbooleantrueWhether the rig drives the camera. Off leaves the camera to scripts.components/CameraRig.ts:30
modeCameraRigMode"thirdPerson"-components/CameraRig.ts:31
targetnumber | nullnullThe entity it follows.components/CameraRig.ts:33
lookCameraRigLook"auto"How the player turns the camera.components/CameraRig.ts:35
distancenumber | nullnullMetres from the point it looks at. Not used in first person.components/CameraRig.ts:38
minDistancenumber1.5Closest distance the scroll wheel reaches.components/CameraRig.ts:40
maxDistancenumber30Furthest distance the scroll wheel reaches.components/CameraRig.ts:42
scrollZoombooleantrueThe scroll wheel changes the distance.components/CameraRig.ts:44
heightnumber1.5Height above the target's origin to look at. In first person, the eye height.components/CameraRig.ts:46
shouldernumber0Metres to the right of the target, for an over-the-shoulder view.components/CameraRig.ts:48
followTimenumber | nullnullSeconds to catch up with the target. Bigger trails further; 0 is locked on.components/CameraRig.ts:51
heightFollowTimenumber | nullnullLike followTime for height, so a jump doesn't shake the view.components/CameraRig.ts:53
deadZonenumber0The target moves this many metres before a fixed view follows it.components/CameraRig.ts:55
yawDegreesnumber | nullnullStarting angle around the target in degrees; the fixed angle in fixed views.components/CameraRig.ts:58
pitchDegreesnumber | nullnullAngle above the target in degrees; in first person, how far up it looks.components/CameraRig.ts:60
minPitchDegreesnumber | nullnullLowest pitch the player can turn to.components/CameraRig.ts:62
maxPitchDegreesnumber | nullnullHighest pitch the player can turn to.components/CameraRig.ts:64
sensitivitynumber1Multiplies how fast the player turns the camera.components/CameraRig.ts:66
invertYbooleanfalseMoving the mouse up looks down.components/CameraRig.ts:68
avoidWallsbooleantruePull in when a wall comes between the camera and the target. Needs colliders.components/CameraRig.ts:71
wallPaddingnumber0.25Metres to keep from a wall.components/CameraRig.ts:73
blendTimenumber0.4Seconds to ease between views when mode changes.components/CameraRig.ts:75