Code Monkey home page Code Monkey logo

modcommunity / dot-fps-controller Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 3.0 23.67 MB

An open source 3D first person player controller for @godotengine that supports bunny hopping, air strafing, and more!

Home Page: https://moddingcommunity.com/topic/187-fps-controller-dot-fps-controller/

GDScript 100.00%
bhop bunnyhop controller fps gdscript godot godot-engine godotengine lerp movement player player-controller scene script strafe strafing

dot-fps-controller's Introduction

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.

Action Description
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!

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

Preview

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

Video

GIF 01

Images

Image 01

Image 02

Credits

dot-fps-controller's People

Contributors

gamemann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.