WanderCam
The Wanderer's third-person camera: a damped orbit around the body it follows, with a spring arm, a lead on movement, and a focus pose a conversation can borrow.
WanderCam
The Wanderer's third-person camera: a damped orbit around the body it follows, with a spring arm, a lead on movement, and a focus pose a conversation can borrow.
Put it on a camera rig's Camera.behavior. It never places a camera of its
own — it poses the entity it is on.
Framing
Three rings around the follow target, each with a height above the target's
origin and a radius out from its axis. verticalAxis slides the camera along
the spline through them (0 at ringBottom, 1 at ringTop) and
horizontalAxis orbits, so a low wide look-up and a high tight look-down are
geometry you can see rather than angle limits you cannot. radiusScale zooms
between minRadiusScale and maxRadiusScale.
Writing any of these re-poses the rig immediately with the damping bypassed, so edit mode shows the shot play mode will produce.
Lead
The aim point slides ahead of the body along its own travel: up to
leadDistance at leadSpeed, eased over leadTau seconds. Walking opens the
view in the direction being walked; standing still settles it back onto the
body.
The travel is differenced off the target's position rather than read from a movement component, so this follows anything that moves.
Focus
cam.focus = { active = true,
position = { x = 0, y = 2, z = -3 },
lookAt = { x = 0, y = 1.5, z = 0 },
fov = 36 }
cam.focus = {} -- give the camera back
While focus.active is set the rig eases to that pose and that aim over
focusTau seconds instead of orbiting, and the Camera's field of view eases
to focus.fov. Look input is dropped rather than accumulated while the focus
holds, so releasing does not swing the view by everything the mouse did in the
meantime. Clearing it eases back to the orbit and to baseFov.
Controls
inputMap names the scheme this camera answers to — look orbits, zoom
scales the rings. Point it at a world's own map to rebind either without
touching this component.
Scoped to this part · feeds back into the world's score.