ForEach Loop unsorting sorted array in blueprint

I’m new to using unreal but I have a bit of experience with coding in general. I tried making a blueprint which finds the shortest distance in four directions and translates an object to it. The problem is that not only does the translation not work, but for some reason, the array I am using for distance will unsort itself once it enters the foreach loop with the vectors of each collision point for my line traces. Any ideas on how I can fix this?


Collapse this spaghetti code into function, use local variables. Use sequence. And do not check if float is EQUAL to anything, there is in range node for that.

1 Like