how do i compare more than 2 floats with blueprints?

see my blueprint where i get 2 distances by having two sequences, but i want more than 2 sequences so i need to compare more than 2 floats. How do i do that?


do you mean ADD PIN on the sequence node? :face_with_peeking_eye:

(post deleted by author)

I will show what I mean in this picture. The blueprint is complex but it does what i wanted. so i guess i answered my own question, but i will show my blueprint for you to see what i mean:


Consider turning the ray trace into a function,

you can put the results of each trace into an array and do a for each loop where you then find the result your looking for i think i saw your other post a moment ago, finding the longest distance this way would be the easiest


a lil something like this

I had a bug in my previous blueprint. This one the bug is fixed:



Function to make ur life easier and that poor bp a lil easier to read


using that function with an array more or less, the concept is there, you’d have to adapt it a lil to whatever this is :sweat_smile:

and if your continually using this you’d wanna reset your arrays before using them again
or you’d compare old results every time and eventually have god knows how big of an array

i haven’t learned how to use arrays yet with blueprints, truth be told. idk the for each loop with blueprints either.

You should be able to pull it off by looking at these pictures and get a good understanding of whats happening, an array is just a collection of variables

My Array
A
B
C
D

so the index would be which item your “looking at” so 0 would be “A” and 1 would be “B” and so on

the for each loop does exactly what it sounds like, for each element ( what we call the variables in an array ) do something, you’d use the Break part of the for each loop to exit the loop early and not continue looking at the variables

“get a copy” takes in an array and an Index
so My Array and say an index of 3 would return the variable D because computers start numbering from 0 so the first element is always at position or index 0

“add to array” would add a variable to the end of the Array
so if we say take My Array add “F” it would become

A
B
C
D
F

but oh no we forgot E
so how can we fix this without redoing the whole thing?
use “swap”
takes in an Array and two indexes so first you’d just do add “E”

But now you have

A
B
C
D
F
E

so then you run the swap with indexes 4 and 5

and then your array would be as intended

A
B
C
D
E
F

It’s fairly simple once you practice it once or twice, i hope this makes some sense as arrays can be a huge part of programming, there’s other things you can do to arrays that i didn’t cover but this is the basics and if you truly wanted to learn them and are struggling i could go make a picture explanation for these, my apologizes if you did know what an array was and just weren’t sure how to use the BP Node equivalents

Thank you for that. I already know arrays from c++, its the blueprints arrays I don’t know.

the bug that was not being able to use the “hit actor” on the longest measured distance. I fixed that with the blueprint i will share now, but this blueprint measures the closest distance which is good for destroying targets which is what i tested for.

713548203c704c5abb92474fc7900664.1-line-trace-function.png (3440×1400) (gamedev.net)

4d77b96ff0f94806ba48c601f359366f.2line-trace-function.png (3440×1440) (gamedev.net)

473bc9410479475f9bc42840eea975a2.3-line-trace.png (3440×1440) (gamedev.net)



I must have made a mistake before where i couldn’t use the hit actor, now i can, so i will share the working blueprint. sorry for the confusion.