FollowZoom
Keeps a target the same size on screen by changing the field of view.
Changes the field of view so the shot stays width wide at the target's distance. As the target moves closer or farther, it keeps its size on screen. Move the camera toward the target at the same time for a dolly zoom: the target stays put while the background stretches.
It runs right after the Body, before the Aim, so the Aim, like RotationComposer, frames with its field of view. Its target is usually the one the Aim looks at.
With an orthographic camera, distance doesn't change how big the target looks, so it sets orthographicSize to show width across instead, and fovRange doesn't apply.
Settings
Usage
import { FollowZoomExtension, HardLookAtAim } from '@pmndrs/klipp';
camera.aim = new HardLookAtAim(player);
camera.addExtension(new FollowZoomExtension(player, { width: 3, damping: 0.5 }));
import { FollowZoomExtensionThree, HardLookAtAimThree } from '@pmndrs/klipp/three';
camera.aim = new HardLookAtAimThree(player);
camera.addExtension(new FollowZoomExtensionThree(player, { width: 3, damping: 0.5 }));
<VirtualCamera name="track" priority={10}>
<Body.HardLockToTarget target={[0, 2, 20]} />
<Aim.HardLookAt target={playerRef} />
<Extension.FollowZoom target={playerRef} width={3} damping={0.5} />
</VirtualCamera>
ref gives you the FollowZoomExtensionThree.