This is a lightweight C++ system to prevent your character from walking off high ledges,
while also keeping the jump in between ledges enabled (Which can easily be toggled off aswell!)
It's simple, optimized, and works out of the box, no plugins or extra setup required.
- Casts line traces in front of the character
- Checks if the player is about to walk off a ledge
- Blocks forward movement if a fall is detected
- All values are tweakable in the header file
Everything is inside the Source/LedgeDetection/LedgeDetectionCharacter.cpp
file.
If you want to copy the code to your own character class, just search for Copy
and copy the part between the following comments:
///////// COPY FROM HERE START ////////
... code ...
///////// COPY FROM HERE END /////////
Make sure to replace the actor/class name where necessary to match your character.
If you have any questions or run into issues, feel free to reach out to me on Discord:
@lootera89 I'll be happy to help.