Suppose, two actors A and B. How to check the distance between A And b, if the distance is increasing or reducing?
Well, the most obvious solution is to get location of them both in world space, subtract location vector A from vector B and get the length of the resulting vector, then store it in some variable. On the next frame do the whole thing again and compare to the stored variable. If it is bigger then the stored one then the distance had increased if smaller then it had decreased.
Thanks for the reply. But can you please show it in blueprint node? I am a newbie. I don’t know how to calculate the next frame.
let’s assume you have a valid reference of ActorB in ActorA. For example through an overlap or a LineTrace.
This is how you calculate the distance between both:
If you do this one time, you have a length you will want to save and compare to a new length. If the old length
is greater than the new one, they are moving away from each other and other way round.