in Blueprint I’m trying to get the closest vector in an array of vectors. I know how to do it in code, I’m just starting to get lost and my result is garbage. I’m sure this is user error. Can anyone help?
#Blueprint Function To Do This For You
Above I tried to help you figure out what the issue is,
but below I am providing a solution you can use to minimize clutter in your BP graphs
I wrote a Blueprint function to do this for you, in my BP Function Library as Plugin
You dont need to compile any code to use it!
just download the plugin (its free, hee hee)
Hiii there!
I am bit confused
You are doing a for each loop
but you are never using the output of the foreachloop, the Array Element!
You are getting out the array index, adding 1 to it, and going back to your source array with that already incremented index
I really think you would want to simplify this
and just use the Array Element straight into the distance comparison
as it is I think you might be skipping elements by adding 1 to the index received out from the foreach loop
if nothing else
reorganizing your BP to use the Array Element might help simplify your logic so you can see the issue better
Good luck!
Send more pics any time!
Rama
It won’t skip, because element 0 is set as the closest at the start, and then in the loop, elements 1+ are compared to the closest.
But it looks to me like it will iterate off the end of the array as a result!