third-person
Installation
SKILL.md
Third-Person Character & Aiming
Most third-person bugs come from hand-rolling the controller and getting a convention backwards. The turnkey path is @pmndrs/viverse SimpleCharacter, which already gives a correct orbit camera (yaw and pitch), camera-relative locomotion, and input bindings — prefer it for the player base and add aiming/shooting on top. If you do hand-roll, the four things below are where it goes wrong.
Camera-relative movement (or A/D inverts)
Movement is relative to where the camera faces. Derive the basis from the camera, not from yaw alone:
const forward = new Vector3()
camera.getWorldDirection(forward)
forward.y = 0
forward.normalize()
const right = new Vector3().crossVectors(forward, camera.up).normalize() // forward × up
const move = new Vector3()
if (input.forward) move.add(forward)
if (input.right) move.add(right) // D = +right; if A/D feel swapped, your right vector has the wrong sign