Modules / Cameras

chasecamera3dplugin

render3d's camera held on one row, a rigid orbit about it.

Putting it in a scene

List it after render3d. The seat's actor tells it which row to follow with follow, and that row carries the fields below.

"plugins": ["loader", "scenemanager", "player", "render3d", "chasecamera3d"]
{
  "pos": [0, 0, 0],
  "lift": 1.6,
  "look": { "yaw": 0, "pitch": 0.35, "dist": 8, "side": 0.6 }
}

Properties

Read from the followed row, every frame.

.pos : [x, y, z]

The row's position, in metres.

.lift : number

Metres above pos that the camera aims at, such as the height of a character's head.

.look : { yaw, pitch, dist, side? }

Where the camera sits round the aim point, with angles in radians. yaw turns it round the vertical axis, and at 0 the camera looks along +z. pitch raises the camera above the aim point; a positive pitch looks down. dist is the distance from the aim point in metres. side moves the aim point that many metres to the right of the way the camera faces, so the body stands off to the left of the screen and a crosshair in the middle looks past its shoulder. The default is 0.

Methods

On the page, through plugins.chasecamera3d.

follow( rowId )

Chooses the row to follow. Call it in the setup of the seat's actor. Until it is called, or on a frame where the row is missing, the camera stays where it was.

eye( ) : { pos, dir }

Where render3d's camera stands and the direction it faces, as world vectors, whoever last placed it.

Camera behaviour

  • The camera moves exactly as the row does. It adds no smoothing, no collision and no limit on distance. To turn or rise gradually, change look or lift on the row over several frames.
  • It places the camera only while no other plugin has claimed it with render3d.claim. A cutscene or the editor's orbit keeps the camera while it holds it, and the camera returns to the row the frame it lets go.

In the guide