SplineDollyLookAtTargets

Looks along a spline dolly's path, or at points placed along it.

Turns the camera as its SplineDolly moves. Without targets it looks the way the path runs. With targets, points to look at placed along the path, it turns from one to the next as the camera travels between them: a tour that looks at the door, then the window, then the stairs.

It reads the path from the camera's Body by itself, so there is nothing to connect.

Settings

SettingDescriptionDefault
targetsPoints to look at, each { position, lookAt }. See Targets.[]
easingHow long the view stays on each target: 0 turns at an even pace, 1 holds it for the first and last third of the way between targets.0

Targets

position is where on the path the target is looked at, in the dolly's positionUnits. lookAt is what to look at: a point in core, an Object3D, ref or point in three.js and React.

Between two targets the camera turns from the one behind it to the one ahead of it. On an open path it keeps looking at the first target before it and at the last one after it. On a closed path the targets go round: after the last one comes the first.

Usage

import { SplineDollyBody, SplineDollyLookAtTargetsAim } from '@pmndrs/klipp';

camera.body = new SplineDollyBody({ spline: path, positionUnits: 'knot', position: 0, damping: 0.6 });
camera.aim = new SplineDollyLookAtTargetsAim({
  targets: [
    { position: 0, lookAt: [0, 1, -4] },
    { position: 2, lookAt: [6, 1.5, 0] },
  ],
  easing: 0.8,
});