Body

Decides where the camera is.

A Body decides where the camera is. Where it looks is up to the Aim. Each virtual camera has at most one Body: setting another replaces it.

Which one?

BodyUse it for
HardLockToTargetPlacing the camera exactly on a target: first person, a camera mounted on something, a fixed spot.
FollowKeeping a fixed offset from a target: chase cameras, third person.
OrbitFollowLetting the user orbit and zoom around a target: third person, inspecting an object.
PositionComposerKeeping a target at a spot on screen: top-down, side-scrollers, anything with a fixed rotation.
CameraControlsLetting the user orbit, pan and zoom. three.js and React only.

Without a Body the camera stays at its starting position, initialState.

Usage

import { FollowBody, HardLookAtAim, targetPose } from '@pmndrs/klipp';

const player = targetPose.create(); // keep player.position and player.rotation up to date

camera.body = new FollowBody(player, { offset: [0, 3, 8], damping: 0.5 });
camera.aim = new HardLookAtAim(player);