Move an actor away from nearby walls

This makes no sense to me why this isn’t working as I expect:

I’m trying to move the spawned actor away from walls. This is my code:

This is my result:

It seems like if it has to move along Negative X then it negates the Y. How would you fix this?

Someone else pointed out that it looks like the distance is being doubled on the -X and it is. I took a more precise screenshot and add the impact normals as a text render to the spawned cubes just to be certain:

I got it working. Broke the trace down into separate pieces for more control and split the vectors so I was only getting the Y data from the Y vectors and the X data from the X vectors and that fixed all the weirdness. Great lesson learned here; sometimes trying to do more in a single function is a bad idea. LOL

Here’s my code if anyone else could use this:

1 Like