@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 ​
| Parameter | Type |
|---|---|
options | CameraRigOptions |
Returns ​
CameraRigComponent
Overrides ​
Properties ​
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
enabled | boolean | true | Whether the rig drives the camera. Off leaves the camera to scripts. | components/CameraRig.ts:30 |
mode | CameraRigMode | "thirdPerson" | - | components/CameraRig.ts:31 |
target | number | null | null | The entity it follows. | components/CameraRig.ts:33 |
look | CameraRigLook | "auto" | How the player turns the camera. | components/CameraRig.ts:35 |
distance | number | null | null | Metres from the point it looks at. Not used in first person. | components/CameraRig.ts:38 |
minDistance | number | 1.5 | Closest distance the scroll wheel reaches. | components/CameraRig.ts:40 |
maxDistance | number | 30 | Furthest distance the scroll wheel reaches. | components/CameraRig.ts:42 |
scrollZoom | boolean | true | The scroll wheel changes the distance. | components/CameraRig.ts:44 |
height | number | 1.5 | Height above the target's origin to look at. In first person, the eye height. | components/CameraRig.ts:46 |
shoulder | number | 0 | Metres to the right of the target, for an over-the-shoulder view. | components/CameraRig.ts:48 |
followTime | number | null | null | Seconds to catch up with the target. Bigger trails further; 0 is locked on. | components/CameraRig.ts:51 |
heightFollowTime | number | null | null | Like followTime for height, so a jump doesn't shake the view. | components/CameraRig.ts:53 |
deadZone | number | 0 | The target moves this many metres before a fixed view follows it. | components/CameraRig.ts:55 |
yawDegrees | number | null | null | Starting angle around the target in degrees; the fixed angle in fixed views. | components/CameraRig.ts:58 |
pitchDegrees | number | null | null | Angle above the target in degrees; in first person, how far up it looks. | components/CameraRig.ts:60 |
minPitchDegrees | number | null | null | Lowest pitch the player can turn to. | components/CameraRig.ts:62 |
maxPitchDegrees | number | null | null | Highest pitch the player can turn to. | components/CameraRig.ts:64 |
sensitivity | number | 1 | Multiplies how fast the player turns the camera. | components/CameraRig.ts:66 |
invertY | boolean | false | Moving the mouse up looks down. | components/CameraRig.ts:68 |
avoidWalls | boolean | true | Pull in when a wall comes between the camera and the target. Needs colliders. | components/CameraRig.ts:71 |
wallPadding | number | 0.25 | Metres to keep from a wall. | components/CameraRig.ts:73 |
blendTime | number | 0.4 | Seconds to ease between views when mode changes. | components/CameraRig.ts:75 |

