Calculate Distance
-
How do I calculate the distance from one object to another and also output that distance?
-
There's a calculate distance behavior in logic. It might be found in the advanced category, but probably not.
Anyway, just use that behavior to select two objects, and then drag its input value into another behavior or a box container.
-
@GameCRAZY's solution will work as long as you never use the zoom screen behaviour (it will calculate the new distance between them when you zoom screen rather than their actual positions).
-
Thanks I dragged the input value from the distance behaviour into a box container and nothing happened.
-
@H34D-SP4C3 Nothing is supposed to happen. You're just storing the distance value to use at a later time. When you're ready to utilize it, drag the box container's input value into a certain behavior.
-
@H34D-SP4C3 it depends on what you want to do with the distance. If you want to show it to the player, you could use it as a value in a set label behaviour. If you want to use it to do something when an object is in range of another, you could use it in an if, e.g. Check whether the distance is less than 5, if so shoot at it or something.