SplineDollyLookAtTargets
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
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,
});
import { SplineDollyBodyThree, SplineDollyLookAtTargetsAimThree } from '@pmndrs/klipp/three';
camera.body = new SplineDollyBodyThree({ spline: curve, positionUnits: 'knot', position: 0, damping: 0.6 });
camera.aim = new SplineDollyLookAtTargetsAimThree({
targets: [
{ position: 0, lookAt: door },
{ position: 2, lookAt: stairs },
],
easing: 0.8,
});
<VirtualCamera name="tour" priority={10}>
<Body.SplineDolly spline={tour} positionUnits="knot" position={stop} damping={0.6} />
<Aim.SplineDollyLookAtTargets
targets={[
{ position: 0, lookAt: doorRef },
{ position: 2, lookAt: windowRef },
]}
easing={0.8}
/>
</VirtualCamera>
ref gives you the SplineDollyLookAtTargetsAimThree.