A simple to setup and easy to edit unity fps controller using rigidbody movement in c#. Almost every variable used in this player controller is customisable and accessible from the inspector (No programing required).
Feel free to use it in your own projects if you'd like!
Trello Link to follow the progress of the next update 🎉
- Fully momentum based movement
- Customizable speeds for:
- Walking
- Sprinting
- Crouching
- Air speed
- Jumping
- Raycast ground detection
- Coyote time
- Jump cooldown
- Variable jump height
- Crouching
- Optional smoothed crouching using
lerp
- Configurable to toggle or hold
- Allow crouching midair or on ground only
- Optional smoothed crouching using
- Inspector
- Simple named vars (easy to understand)
- All vars contain quick descriptions within tool tips
- GUI based layer choice (choosing ground layer)
- Camera
- Variable smoothing of the camera
- Clamped look directions
- Variable sensitivity
- Cursor lock/unlock
- Configurable keys: ()
- Jumping
- Crouching
- Sprinting
- Lock/Unlocking mouse
- Fast auto setup in one button button click
- Creates and sets up rigidbody
- Creates and sets up camera
- Sets unity physics gravity to -19
- Ask user if they want to set custom gravity
- Ask and create "Ground" tag if it does not exist
Variable Jump Height & Jump Cooldown | Smoothed lerp Crouch vs Non-Smothed |
Coyote Time (Slowed & Exaggerated) |
---|---|---|
This script is currently setup with these default controls. These are all configurable from the editor. (don't require any coding)
Key(s) | Action |
---|---|
WSAD | Simple character movement |
Space | Jump |
Shift | Sprint |
Z* | Crouch |
Q | Lock/Unlock Mouse |
- Download and add the files to your assets folder
- Add a capsule to your scene
- Add the Player Movement script through Component -> Player Movement and Camera Controller
- Click the "Setup Player & World" button (I have not updated the old images yet, tho everything is in the same location)
Done, you should now be left with something similar to the bellow
Please make sure that whatever the player is intended to stand/jump onto or from is set to the Ground
tag.
When setting up the script, you will be prompted to let the script create the tag for you (I have not and prob wont create an algorythm/ai to detect what should and shouldn't be ground... so you will have to manually lable what should be ground).