Run & understand the third-person character
site/media/lessons/capstone-third-person.lesson.ts (6 steps) The fastest way to understand the third-person character is to run it, then read how the two
components produce what you saw. The video above is the real third-person example driven in
the editor.
Run it
Section titled “Run it”-
Open the third-person scene in the editor. Load
examples/scenes/third-person.vscn.json. You’ll see the character on a ground plane with a few pushable props.
The third-person scene. -
Enter play mode to run the character controller. Press Play. The runtime boots and the
CharacterController+CameraTargetcomponents come alive.
Play mode runs the real character controller. -
Drive the character forward with
W. Movement is applied to a RapierKinematicCharacterControllerin theprePhysicsphase, which collide-and-slides the character along the ground.
WASD movement via the KCC. -
Strafe and turn with
A/D. The horizontal speed feeds the AnimGraphspeedparameter, blending idle → walk → run.
Locomotion blends with movement speed. -
Orbit the follow camera with the mouse. The
CameraTargetcomponent tracks yaw/pitch and positions the runtime camera behind the character inpreRender.
The orbit follow camera. -
Stop play mode. Press Stop (or
Escape) to return to editing.
How it works
Section titled “How it works”CharacterController(components.ts, phaseprePhysics) owns the RapierKinematicCharacterController. Each tick it reads input, builds a move vector, applies gravity and (on thejumpaction) an upwardjumpVelocity, and calls the controller to move-and-slide. It writes the resulting horizontal speed into the AnimGraphspeedparam and fires ajumptrigger when jumping.CameraTarget(components.ts, phasepreRender) owns the orbit camera and pointer-lock DOM wiring, tracking yaw/pitch as instance fields, and places the runtime camera behind the character — after movement and animation, so the camera never lags a frame.- AnimGraph blends
idle/walk/runby thespeedparameter (see Blend trees).
Recap
New functionality
- Ran the third-person character and controlled it with WASD + mouse
- Saw the follow camera orbit
- Saw locomotion animation blend with speed
New concepts & skills
- A KinematicCharacterController moves a character with collide-and-slide in prePhysics
- Horizontal speed drives an AnimGraph blend (idle/walk/run)
- The follow camera positions in preRender, after animation, to avoid lag
- Movement vs. camera live in different phases by design
Next lesson → Manual: AnimGraph
See also
Section titled “See also”- Capstones — the other games.
- Physics: rigid bodies · Animation: anim graph · Input