Actually good first person controller for the Godot Engine.
MIT License (credit Colormatic Studios)
This first person controller was made because there weren't many first person controllers for Godot at the time, and the ones that did exist were pretty bad. It is highly customizable and comes with many features, QOL, and clean code.
Originally inspired by StayAtHomeDev's FPS tutorial. You can find that here.
Move with WASD, space to jump, shift to sprint, C to crouch.
FEATURES:
- Extremely configurable
- In-air momentum
- Motion smoothing
- FOV smoothing
- Movement animations
- Crouching
- Sprinting
- 2 crosshairs/reticles, one is animated (more to come?)
- Controller/GamePad support
- In-editor tools (enable editable children to use)
If you make a cool game with this addon, I would love to hear about it!
Either use a terminal, or use a graphical Git application like Git Cola. You need to install Git or a Git GUI application.
IMPORTANT: If at any point you get an error, do not continue without fixing it.
Terminal instructions
- Create a new folder for your project, we'll call this the project folder
- Open a terminal
- Write
cdin the terminal, do not press enter yet (cdmeans change directory) - Copy the path of your new folder in your file manager and paste it into the terminal with
ctrl+shift+v(make sure there is a space aftercd). This should look like:cd path/to/project - Press enter in the terminal
- Paste the command
git clone https://git.colormatic.org/ColormaticStudios/quality-godot-first-person.git .into the terminal withctrl+shift+vand press enter. This will pull the Quality First Person Controller project into your folder, including the test scene - Open Godot Engine and press the import button, then find the
project.godotin the project folder and open it - You should now have the project open in Godot. Remap all of the keys in input map to your preferences
GUI instructions
- In your Git GUI, click the "Clone" button
- Paste
https://git.colormatic.org/ColormaticStudios/quality-godot-first-person.gitinto the URL box and press enter - Select the folder where you want to put the project. This will pull the Quality First Person Controller project into your folder, including the test scene
- Open Godot Engine and press the import button, then find the
project.godotin the project folder and open it - You should now have the project open in Godot. Remap all of the keys in input map to your preferences
To start out, you should probably remap all of the movement keys to your own control set.
You can make this a super basic controller by just disabling everything.
Slope/staircase:
Credit to roberto-urbani23
In the character inspector, you can uncheck Stop on Slope and set the max angle to 89 (for some reason, 90 will make the player stuck). Also Snap Length to 1 otherwise your character will not remain attached to stairs if you sprint while going downstairs.
How to change settings:
Click on the character node and there should be settings in the "Feature Settings" group.
How to add animations for a mesh:
- Create a function for your animation and attach it to
_physics_processto call it every frame. - Use
input_diras a boolean (it is actually aVector2) to know if the player is walking. - Use the
statemember variable to tell if the player is sprinting or crouching. - Use the
is_on_floorfunction to tell if the player is standing or falling.
How to change reticles (crosshairs):
Change the "Default Reticle" setting to your reticle file.
During runtime:
Use the change_reticle function on the character.
How to create a new reticle:
- Choose a reticle to base it off of.
- Open that reticle and save it as a new reticle.
- Remove the script from the reticle and create a new one. (for some reason you have to do this)
- Edit the reticle to your needs.
- Follow the "how to change reticles" directions to use it.
How to use the editor tools:
- Enable editable children on the
CharacterBodynode - Use the options in the Properties tab to change things
- These changes apply in runtime as well