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?
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);
import { Vector3 } from 'three';
import { FollowBodyThree, HardLookAtAimThree } from '@pmndrs/klipp/three';
camera.body = new FollowBodyThree(player, { offset: new Vector3(0, 3, 8), damping: 0.5 });
camera.aim = new HardLookAtAimThree(player);
import { VirtualCamera, Body, Aim } from '@pmndrs/klipp/react';
<VirtualCamera name="follow" priority={10}>
<Body.Follow target={playerRef} offset={[0, 3, 8]} damping={0.5} />
<Aim.HardLookAt target={playerRef} />
</VirtualCamera>