hyperPad hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Calculate Distance

    Scheduled Pinned Locked Moved
    Help and Support
    4
    6
    442
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      H34D SP4C3
      last edited by

      How do I calculate the distance from one object to another and also output that distance?

      Jack8680J 1 Reply Last reply Reply Quote 0
      • GameCRAZYG
        GameCRAZY
        last edited by

        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.

        Aidan_FireA 1 Reply Last reply Reply Quote 0
        • Aidan_FireA
          Aidan_Fire @GameCRAZY
          last edited by

          @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).

          1 Reply Last reply Reply Quote 0
          • H
            H34D SP4C3
            last edited by

            Thanks I dragged the input value from the distance behaviour into a box container and nothing happened.

            1 Reply Last reply Reply Quote 0
            • GameCRAZYG
              GameCRAZY
              last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • Jack8680J
                Jack8680 @H34D SP4C3
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post