A template for first person POV system for character using Godot Engine 4
W A S D
: Forward, Left, Backward, Right
Spacebar
: Jump
Shift
: Sprint
Ctrl
: Crouch
- Character Movement Speed
- Walking, sprinting, and crouching speed (crouching takes prirority over sprinting)
- Gradual movement speed using
lerp()
function (so it doesn't looks snappy/choppy)
- Character Collision
- Changes collision height when crouching
- Stay crouching when object/collision detected above character's head using RayCast3D node
- Character Camera (Player's POV)
- Camera rotation based on mouse movement
- Y-axis rotation is set so camera can't rotate too much that can cause the world's view inverted (upside-down)
- Camera height follows when character's crouching
(also using
lerp()
to prevent snappy/choppy movement)
- Camera rotation based on mouse movement
Note: The jumping mechanism is already GDScript built-in