Hi all,
I’m trying to figure out how to properly “launch” my character off of sloped surfaces when they reach the edge, rather than just falling off of them. By default the character movement component considers the player’s Z velocity to be 0 whenever they’re on the ground, which causes the player to instantly start falling down once they reach the edge of a ramp. Here’s an artistic rendition of the issue, with the dashed line being the player’s path:
I’ve tried storing the capsule component’s linear velocity each frame (which actually does include Z velocity) and then applying that to the player once they’ve begun falling, but unfortunately that doesn’t seem to work very consistently. Sometimes it doesn’t launch the player at all, sometimes it does, sometimes it doesn’t launch them far enough, etc. I’m guessing this is because the capsule component’s velocity is tied to the character movement component’s velocity, so the capsule component’s velocity is updated to 0 when the player begins falling. I’ve tried only storing the velocity when it hasn’t decreased since last frame to account for this, but that doesn’t seem to have helped.
The next thing I tried was creating a C++ child class of the character movement component to override the functions that zero out the Z velocity. Unfortunately though, most of those functions aren’t virtual, so I’m guessing there’s no way to override them without building UE5 from source and editing the original class.
Any input would be super appreciated, either with blueprints or C++! Thanks!!