Recipes
Third-person follow camera and platformer jump movement
The camera trails a visible avatar and the avatar walks, runs, and jumps over a ground plane or platforms. Use
CharacterMovementComponent for arcade-feeling kinematic motion; reach for a RigidBodyComponent only when you want full dynamic Rapier physics (see physics-colliders-rigidbodies).engine v1.0.234since component-field-contract ecs.component-field-contract.v1, action-catalog.v1.0.232, camera.v1, physics.v1Copy for LLM
Use this for
third-person adventure, platformer, runner; a follow camera behind or above the avatar; jumping, gravity, and a ground plane
Not for
first-person mouselook (use first-person-controls); flight or zero-gravity sims; strict physics ragdolls
Pairs with: First-person camera movement and mouselook controls, Camera feel field of view smoothing tone mapping and post, Physics colliders rigid bodies triggers and joints, Spawn points checkpoints and respawn flow
The recipe
- Create the avatar entity (
project_create_entity) withTransformComponent, aRenderableComponent{ "type":"RenderableComponent", "visible":true, "shape":"capsule", "renderSpace":"world" }, and aColliderComponent(capsule,collision: "solid"). - Attach
CharacterMovementComponent{ "type":"CharacterMovementComponent", "enableKcc": true, "maxSpeed": 7, "gravity": 22, "jumpSpeed": 9, "groundY": 0 }.gravityandjumpSpeedare the vertical motor;groundYis the resting floor height. - Create a SECOND entity for the camera with its own
TransformComponentand aCameraComponent. SetfollowEntityIdto the avatar's entity id and tunefollowOffset{ "x":0, "y":6, "z":10 }(behind and above) andfollowSmoothing(0..1; higher lags more). Optionally setlookAtEntityIdto the avatar so the camera keeps it centered. - Bind a jump input: add a
booleanaction (for exampleplayer.jump) to the avatar'sInputProfileComponentwithpolicy.effectSystem: "movement"and akeyboardSpacebinding, following the default profile shape. - For platform hazards or moving platforms, give those entities a
ColliderComponent(collision: "solid") and, for movers, aNetworkProfileComponent{ "type":"NetworkProfileComponent", "interpolation":"smooth" }so remote clients see fluid motion.
Pitfalls
followSmoothingis clamped 0..1. Values near 1 make the camera feel like it is on a rubber band; 0.1 to 0.2 reads tight. Default is 0.15.CharacterMovementComponenthas replication policy None: it is authored config consumed identically by client predictor and server authority. Do not expect it to appear in replicated snapshots.- Do not author
VelocityComponentto launch a jump; it is a hidden internal runtime lane. ConfigurejumpSpeedon movement, or from a script callctx.physics.commandwith{ type: "launch" }. - The follow camera must be a different entity from the avatar, or
followOffsethas nothing to offset from.
Verify
project_get_graph_snapshotto confirm the camera entity'sfollowEntityIdresolves to the avatar id.simulation_runto prove the avatar jumps and lands atgroundY.qa_capture_renderer_viewportto confirm the avatar is framed by the follow camera.