Calculating distance from actor/order of appearance
I have three actors stood in a line inside a box trace of a static object. One of the actors is the player pawn and the other two actors are children of a master actor class. What I'm having trouble doing is detecting what order the actors are stood in. I can calculate the distance from two objects by subtracting the locations and breaking the vector to get the Z distance, or I can split the locations and compare the Z locations, but what I can't seem to figure out is how I compare all locations of each actor that enters the static objects box trace to find the order they are stood in.
What I am trying to do is increase a variable depending on how far away they are from the object. +1 for the closest, +2 for the actor behind the closest, and +3, +4 and so on.
asked Sep 06 '17 at 02:54 PM in Blueprint Scripting
Hi, you can just use a node called "get distance to" to get the distance between actors. It returns a float value, then you could compare those using some less thans and make something happen on the result of that. I hope that helps.
answered Sep 06 '17 at 06:38 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here