โ† All examples

godot components

First-person controller with crouch, sprint and head bob

Drive a CharacterBody3D first-person player: mouse look with a pitch limit, walk, sprint and crouch speeds, jumping, head bob, and a crouch that refuses to stand up under a ceiling.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • example.tscn
  • fps_controller_3d.gd
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_fps_controller_3d.gd
  • verification/native.json

How it works

Class
BaltorFirstPersonController, extends CharacterBody3D
Methods
look(relative: Vector2) -> void; get_pitch() -> float; get_head() -> Node3D; set_move_input(input: Vector2) -> void; set_sprinting(sprinting: bool) -> void; set_crouching(crouching: bool) -> bool; is_crouching() -> bool; press_jump() -> void; and 6 more
Signals
jumped, landed, crouch_changed
Exports
mouse_sensitivity, pitch_limit_degrees, walk_speed, sprint_speed, crouch_speed, ground_acceleration, air_acceleration, jump_velocity and 13 more
Placement
res://baltor/godot_components/fps_controller_3d/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_example_scene
  • godot_readme_usage_compiles

Limits to consider

No ladders, swimming, slopes speed changes or stairs stepping. The collision shape is not resized when crouching; only the head moves, and the stand-up test checks the space above the current shape. Mouse look runs only while the mouse is captured. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.