Jump to content

FPS Controller For Godot (dot-fps-controller)


Christian
 Share

Recommended Posts

  • Superuser

Dot-FPS-Controller is an open source 3D first-person player controller for Godot Engine (made in version 4.2+). This controller currently supports air strafing, bunny hopping, crouching, walking, and more!

 

This asset is a big work in progress and we plan on adding more features along with improving the current player movement in the future as we develop our own open source games.

 

Features

  • Air strafing
  • Bunny hopping
  • Crouching
  • Walking

 

Godot Input Actions
The following input actions need to be added to the Godot project via Project -> Project Settings -> Input Map for the controller to work properly.

 

  • player_l - Moves the player to the left.
  • player_r -Moves the player to the right.
  • player_f - Moves the player forward.
  • player_b - Moves the player backward.
  • player_jump - Has the player jump.
  • player_crouch - Has the player crouch.

 

Note - Mouse wheel up button is supported for the player_jump input!

Note - The player_crouch input works as a press/release. Therefore, the player must hold the input down to crouch and release it when they want to stop crouching.

 

Controller Settings

The following are variables exported by the player controller that can be modified outside of the controller.

 

Warning - These settings are a bit messy right now and will be overhauled in the future!

 

  • MAX_G_SPEED - The maximum ground/base speed. (default 6.0)
  • MAX_W_SPEED - The maximum walk speed. (default 4.0)
  • MAX_C_SPEED - The maximum crouch speed. (default 3.0)
  • MAX_G_ACCEL - The maximum acceleration speed. (default 20.0)
  • MAX_AIR_SPEED - The maximum speed while in the air. (default 0.5)
  • MAX_AIR_ACCEL - The maximum acceleration while in the air. (default 100.0)
  • JUMP_FORCE - The force to apply vertically when jumping. (default 4.5)
  • GRAVITY_FORCE - The gravity force to apply when the player is in the air. (default 15.0)
  • MAX_SLOPE - To Do... (default 0.803)
  • LERP_SPEED - The lerp time. This is times with the delta when using lerp() to smooth out player movement. (default 12.0)
  • FRICTION - The amount of friction to apply to the player when moving. This is also used in the lerp() function when smoothing out player movement. (default 10.0)
  • CROUCH_DEPTH - Subtracts this value from the y position of the player controller's camera when the player is crouching. (default -0.5)
  • FLOOR_RAY_POS - To Do... (default (0, 0, 0))
  • FLOOR_RAY_REACH - How far to create a ray to the ground when detecting if the player is on the floor. (default 3.0)
  • MOUSE_SENS - The mouse sensitivity. (default 0.002)
  • AUTO_BHOP - When on, the player can hold in the player_jump input and automatically jump when detected on the floor. (default false)

 

Preview

Here are some GIFs and images showcasing the controller as of 3-2-24.

 

previewgif1.gif

 

preview1.png

 

preview2.png

 

 

 

Credits

 

Source Code

Link to comment
Share on other sites

  • The title was changed to FPS Controller For Godot (dot-fps-controller)
  • The topic was pinned

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site you agree to the Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.