← PathwayLesson 3 · Player Controller & CameraNext lesson →

Lesson 03 · 65 minutes · Control layer

Make movement feel intentional.

Upgrade the basic player into a third-person controller that accelerates, jumps, turns toward motion, and keeps the camera from clipping through walls.

CHARACTERBODY3DDELTA TIMEJUMPSPRINGARM3DCAMERA
Big ideaGood controls are a conversation between input, physics, and camera.
PredictAcceleration changes stopping distance; it should not change the jump rule.
TestTurn, stop, jump, and back into a wall as separate tests.
Why it mattersSeparating layers lets you tune how movement feels without breaking collision.
01 / RIG

Scene structure

Separate physics, visuals, and viewpoint.

player.tscnPlayer · CharacterBody3DCollisionShape3DVisual · Node3DMeshInstance3DCameraPivot · Node3DSpringArm3D → Camera3D

The root owns movement and collision. The Visual child turns without changing the collision body. SpringArm3D pulls the camera closer when a wall blocks its path.

Godot's Scene dock showing a Player node with CameraPivot, SpringArm3D, and Camera3D nested three deep, highlighted with a yellow box.
The tree above, for real. CameraPivot holds SpringArm3D, which holds Camera3D — exactly the nesting in the mini-tree, just with real icons and a real Player rig around it.
Godot's Inspector for a selected SpringArm3D node, with the Spring Length property set to 3 meters highlighted.
One number does the collision-avoidance work. Spring Length is how far the arm reaches before it starts pulling the camera in — raise it and the camera sits farther back until a wall gets in the way.

Screenshots: Godot Engine documentation, © Juan Linietsky, Ariel Manzur and the Godot community, CC BY 3.0.

02 / MOVE

Responsive motion

Accelerate instead of snapping.

player.gd · movement
extends CharacterBody3D

@export var speed := 6.0
@export var acceleration := 18.0
@export var jump_velocity := 7.0
var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")

func _physics_process(delta: float) -> void:
    var input := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
    var direction := (transform.basis * Vector3(input.x, 0, input.y)).normalized()
    velocity.x = move_toward(velocity.x, direction.x * speed, acceleration * delta)
    velocity.z = move_toward(velocity.z, direction.z * speed, acceleration * delta)
    if not is_on_floor(): velocity.y -= gravity * delta
    if Input.is_action_just_pressed("jump") and is_on_floor(): velocity.y = jump_velocity
    if input.length() > 0.1: $Visual.rotation.y = atan2(-input.x, -input.y)
    move_and_slide()
Why delta? Acceleration and gravity are rates over time. Multiplying by delta makes them behave consistently across different frame rates.
03 / CAMERA

View control

Rotate a pivot, not the whole player.

Add camera_look as a mouse motion handler. Clamp vertical rotation so the camera cannot flip upside down.

player.gd · mouse look
@export var mouse_sensitivity := 0.002
@onready var camera_pivot: Node3D = $CameraPivot

func _ready() -> void:
    Input.mouse_mode = Input.MOUSE_MODE_CAPTURED

func _unhandled_input(event: InputEvent) -> void:
    if event is InputEventMouseMotion:
        rotate_y(-event.relative.x * mouse_sensitivity)
        camera_pivot.rotate_x(-event.relative.y * mouse_sensitivity)
        camera_pivot.rotation.x = clamp(camera_pivot.rotation.x, -1.0, 0.6)
    if event.is_action_pressed("ui_cancel"):
        Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
04 / PREDICT

Coordinate check

Why transform the input?

What does multiplying the input vector by transform.basis accomplish?

05 / TUNE

Playtest

Tune one feeling at a time.

  1. Test stopping distance.Raise acceleration for crisp arcade control; lower it for slippery momentum.
  2. Test jump shape.Adjust jump velocity and gravity separately. Height and fall speed are different feelings.
  3. Test camera collision.Walk backward toward a wall and confirm SpringArm3D shortens instead of letting the camera pass through.
  4. Test recovery.Press Escape to release the mouse and confirm the player cannot double-jump.

Remix challenge

Add a sprint action. Hold Shift to multiply speed by 1.6, but only while the player is on the floor.

Duplicate the project as SignalRun_03_Controller.Your restore point must pass the wall-camera, single-jump, and stop-distance tests.
06 / CHECK

Definition of done

Your controller works when…

0/4 checked

Evidence: Record one test showing turn-relative movement, one jump, a full stop, and camera collision.

Lesson 3 complete

Your project now feels like a game you can inhabit.