I made a custom momentum system that essentially has 2 momentum variables, 1 for left and 1 for right. I have them change in relation to one another, making an ice levelly type of feeling to it, while still giving the player a good amount of control. I was wondering how I could make an event, in essentiality, telling the character to stop in their tracks upon hitting a wall. As it is, they just keep sliding into it.
How to cancel momentum upon hitting a wall? (custom momentum system)
Target the physics component and use
Set Physics Linear Velocity.
You’ll want to use UPrimitiveComponent::OnComponentHit. It’s a virtual function that you can override.
Add a static mesh component to your actor, something like a cylinder, set it to be invisible, and overlap all, then use it’s overlap events to detect walls.
You can fine tune that logic further by only using it when you’re sliding on ice, or only collisions on the side of the actor that it is heading towards, but I’ll leave that to you.
Thanks, but I was mostly just looking for an event to trigger when I bump into the wall. Would it be a hit register or something else?