Renderer · class
CinematicCamera
Explained in Hello world.
class CinematicCameraimport { CinematicCamera } from '@driftengine/core';Constructor
new
constructor(colliders: ColliderSet)| Parameter | Type | Description |
|---|---|---|
colliders | ColliderSet |
Properties
| Name | Type | Description |
|---|---|---|
camerareadonly | Camera |
Accessors
| Name | Type | Description |
|---|---|---|
shotAgeSecget | number | Seconds since the current shot began. |
Methods
cut
cut(shot: ShotParams, atSec: number): voidSwitch shots, now.
| Parameter | Type | Description |
|---|---|---|
shot | ShotParams | |
atSec | number |
More
atSec is the shot's own start time, used by anything that animates within
a shot — an orbit's angle, for instance — so a shot looks the same whenever
in the run it is used.
snap
snap(): voidDrop the smoothing history, keeping the shot.
More
For a subject that teleports — a character who died and is back on a checkpoint, or a scrub bar dropped somewhere else in the run. Smoothing across that is a camera flying the length of the route with nothing in frame, measured at 124 m inside a single shot, and it looks far more like a bug than a cut does.
A threshold inside update would be the wrong place for this. Only the
caller can tell a teleport from a legitimately fast frame: a replay catching
up after a freeze advances several simulation ticks in one frame, and a
browser that dropped a frame advances a dozen. That is also why this is not
cut — the two differ over whether the speed across the frame means
anything, and the caller is the only one who knows.
update
update(frameDt: number, subjectX: number, subjectY: number, subjectZ: number, subjectYaw: number): void| Parameter | Type | Description |
|---|---|---|
frameDt | number | |
subjectX | number | |
subjectY | number | |
subjectZ | number | |
subjectYaw | number |