Skip to content

nano13/GodotFirstPersonController

 
 

Repository files navigation

Godot 4 - Advanced First Person and Vehicle (Car, Motorbike) Controller

Open Bugs:

This project contains the implementation of a First Person character controller for Godot 4 for walking on Land, swimming in Water and moving Ladders up and down.

The code found in player.gd uses vector forces to move the player. You can tweak the values of the forces in the editor directly. The velocity of the player is calculated as a result of the vector sum of different vector forces: walk, jump, gravity and drag.

This project contains Blender Models so in order to be able to run it, you need to have Blender installed and set up the path in your Godot Editor-Settings -> FileSystem -> Import. After setting up this path, you will need to restart Godot.

The main scene is a Sandbox scene used to test the controls:

EditorView

Controls Player (FPS-Controller)

Keys Action Name Description
W,A,S,D, left stick move_ + dir Move
mouse, right stick look_ + dir Look/Aim
Space, Xbox Ⓐ jump On Land or Water Surface: Apply jump force;
In Water: Swim Up;
In Air: Press a second time to hold yourself in the air;
On a Ladder: Let go and fall down.
Ctrl, crouch On Land: Crouch; In Water: Swim Down
Shift, walk Slower Walking Speed
Q, jump_high Apply alternative, higher jump force (stackable to fly up high).
F, flashlight Toggle Flashlight
M, map Show Player on Map (switch to alternative Camera hovering above Player). Use Mouse Wheel to Zoom in/out.
ESC, Xbox Ⓑ exit Close the game

You can change any of this keys in: Project Settings → Input Map.

Controls Vehicles

Source of the Car-Modell EditorView

Source of the Motorbike-Modell EditorView

You need to stand close to the Motorbike in order to enter it. To enter the car, you need to stand directly at one of the front doors.

Keys Action Name Description
E use Enter/Exit Vehicle
W,S vehicle_accelerate; vehicle_decelerate Forward; Break; Backward
A,D vehicle_left; vehicle_right Left; Right

About

Basic First Person Controller for Godot 4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • GDScript 100.0%