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

    Need help with some math logic

    Scheduled Pinned Locked Moved
    Help and Support
    2
    8
    116
    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.
    • SplitMindGamingS
      SplitMindGaming
      last edited by

      Im trying to create a near miss logic. Basically i have an item falling from the sky. If it misses the player by inches i want them to be rewarded for it by showing a text saying something like “near miss +2 points”. Ive tried a few approach but my math sucks when it comes to these things. What i tried so far was getting position of object a and object b. Then used an if statement saying if object a x is = to object b x then show text bubble on object a with “near miss”. But i know for sure theres more to this equation.

      1 Reply Last reply Reply Quote 0
      • bosswaveB
        bosswave
        last edited by

        You could just have an empty, transparent object with a collision larger than the player (representing the range of your “near miss) and have the “near miss” event trigger if the projectile or whatever stops colliding with the empty object and never collides with the player.

        You could also do something simple and similar with calculate distance behaviors to set a radius.

        There might be a more efficient way of doing this, but this is what I would do :)

        SplitMindGamingS 2 Replies Last reply Reply Quote 0
        • SplitMindGamingS
          SplitMindGaming @bosswave
          last edited by

          @bosswave this is actually really smart. I just tried this out. I put an empty object and weld attached it yo my player. I changed the mass to zero. Im running into a problem however. If my main character bumps into an object it would rotate my character uncontrollably even when i have lock rotation off on both the main character and the weld attach object. Ive actually ran into this problem alot with weld attach. Any thoughts on how to fix this?

          1 Reply Last reply Reply Quote 0
          • SplitMindGamingS
            SplitMindGaming @bosswave
            last edited by

            @bosswave im thinking this is a bug actually with weld attach. Lock rotation does not work with it.

            1 Reply Last reply Reply Quote 0
            • SplitMindGamingS
              SplitMindGaming
              last edited by

              Heres a simple project file. Hold and drag the green square. Its suppose to have rotation locked. But it doesnt. If you turn off the weld attach. Lock rotation will start working again.Weld attachment bug.tap

              bosswaveB 1 Reply Last reply Reply Quote 0
              • bosswaveB
                bosswave @SplitMindGaming
                last edited by

                @SplitMindGaming try a pivot attach set to “pin”. That should (hopefully) fix it. I never have much luck with weld attach.

                SplitMindGamingS 1 Reply Last reply Reply Quote 0
                • SplitMindGamingS
                  SplitMindGaming @bosswave
                  last edited by

                  @bosswave yup that works. Thanks so much

                  bosswaveB 1 Reply Last reply Reply Quote 0
                  • bosswaveB
                    bosswave @SplitMindGaming
                    last edited by

                    @SplitMindGaming Any time :)

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