Get character to stop on initial overlap? (Sphere Trace)

Hello. Here’s my problem: Basically, I had to modify my collision detection because of the movement system I’m using overriding it. An essential part of the collision detection is a custom function that does a sphere trace each frame and prevents my character from moving when the sphere hits a wall. However, I noticed that my character kept getting stuck in walls with this implementation. I had no idea how to fix this, and tried searching various forum/AnswerHub topics/pieces of documentation to no avail. And then I noticed that I still have some freedom to move while the sphere is hitting a wall. It seems like, while the sphere trace is working, it’s allowing my character to get a little too close to the wall, which is causing the collision issues.

The sphere trace starts around here:

However, it only stops me from going through the wall when I’m around here:

While this doesn’t usually cause problems when I just run up to the wall and then run away from it, when I drop down from the top of the wall while walking into it, this happens:

What I want to know is, how do I get my character to stop the moment my sphere trace comes up with a hit?

My custom function currently looks like this:

I did hear about an “Initial Overlap” node that was added to Break Hit Result, and I think it would be perfect. However, I have no idea how to integrate it; simply plugging it into Return Node does nothing. I’d really like to know how to do this. Thank you.

Maybe try to make the trace ends a few units in front of your character moving direction, so when it is trying to get away from a wall, the trace will not collide the wall and your character should not stay stuck anymore.

I think LimasseFive’s answer will be the most effective. In fact, why not just use a line trace to begin with and ditch the sphere trace?

You could always send the trace in the direction of movement and stop on impact.

If I only use a line trace, I just phase through the walls.

Also, I just combined both Line Trace and Sphere Trace and it doesn’t do this! Though sadly, I’m now phasing through geometry a bit. Not getting the stuck in walls problem though!

Why wouldn’t line trace work?

What do you mean phase through walls?

If you hover over the initial overlap pin, it explains that when it is true, then the Normal pins change to be a depenetration vector, and it changes a few other things as well.

Initial Overlap occurs when the colliding object is overlapping instead of just colliding. If this is the case then it HAS to change the outputs because in that situation it is not able to decide which point on the surface of the collider is THE ONE that is the point of collision. There’s so many spots it COULD be so it is returning a depenetration normal instead of the impact normal of a single point.

The Location output changes too.

I dont nnow how those alternate outputs are calculated but it might be the key to my own problem, since I am also struggling withthis. My game sets the actor location along a spline which by nature overrides most of the built in atuff that keeps the character from going through walls so i have been capsule tracing similar to your strategy to deal with that, but there are so many ways this can fail to work properly and I am learning the hard way. I think the depenetration normal could be used to make a secondary line trace to determine where to reposition the character to be flush with the wall. I’m going to try that strategy later when i get the chance