GoldGdt
Character controller add-on for Godot 4 that simulates the movement found in the GoldSrc engine.
Attribution
Trace class, _cast_trace()
function, and _move_step()
function
- Q_Move by Btan2
- Godot-Math-Lib by sinewave
Changelog
Update 3
- Made a more thorough pass on step detection logic, and now most issues should be fixed.
- Added in the new
GoldGdt_Pawn
component, which currently only provides the ability to change desired view rotation with a function.- Also works in editor when you edit the pitch and yaw variables, thanks
@tool
!
- Also works in editor when you edit the pitch and yaw variables, thanks
- Added in a condition to
_move_body()
inside of theGoldGdt_Body
component that toggles "Stop on Slope" based on movement.- This fixes two issues in one fell swoop. Issue 1 was Jolt Physics caused player to jitter while standing still if "Stop on Slope" was false, but it has to be false for wall-strafing to work, so now both should be working as intended.
- If there is a better fix that involves changing Jolt Physics settings, please let me know!
Roadmap
- Creating a system for ladder and water movement.
- Viewmodel system (ancillary change).
- 1P/3P model swapping system (ancillary change).
Installation
From GitHub:
- Open your Godot project.
- Copy the "addons" folder from this repository into the project folder for your Godot project.
- Enable "GoldGdt" in your project's addon page.
- Reload your project.
- Drop the "Pawn" scene into whatever other scenes you need it in.
Setup
Foreword
I heavily recommend using Godot Jolt for the physics engine, but this add-on should still work with GodotPhysics if you so choose.
Input Map
GoldGdt has pre-defined inputs that it is programmed around. Unless you want to go into the code and change them to your own input mappings, I recommend recreating these inputs in your Project Settings, binding them to whatever you see fit.
Player Parameters
All bundled components require a reference to a Player Parameters resource, which contains things like player speed, acceleration, etc...
You can create a new Player Parameters resource by right clicking in your FileSystem, opening up the Create New Resource window, and creating a new Player Parameters resource.
Everything is self explanatory, but anything categorized as "Engine Dependant" must be in meters. If you want to convert speed from GoldSrc to Godot, remember that GoldSrc measures units in inches.