Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. Need help with some math logic

Need help with some math logic

Scheduled Pinned Locked Moved Help and Support
8 Posts 2 Posters 902 Views 1 Watching
  • 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 Offline
    SplitMindGamingS Offline
    SplitMindGaming
    wrote on last edited by
    #1

    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
    0
    • bosswaveB Offline
      bosswaveB Offline
      bosswave
      wrote on last edited by
      #2

      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
      0
      • bosswaveB bosswave

        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 Offline
        SplitMindGamingS Offline
        SplitMindGaming
        wrote on last edited by
        #3

        @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
        0
        • bosswaveB bosswave

          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 Offline
          SplitMindGamingS Offline
          SplitMindGaming
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • SplitMindGamingS Offline
            SplitMindGamingS Offline
            SplitMindGaming
            wrote on last edited by
            #5

            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
            0
            • SplitMindGamingS SplitMindGaming

              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 Offline
              bosswaveB Offline
              bosswave
              wrote on last edited by
              #6

              @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
              0
              • bosswaveB bosswave

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

                SplitMindGamingS Offline
                SplitMindGamingS Offline
                SplitMindGaming
                wrote on last edited by
                #7

                @bosswave yup that works. Thanks so much

                bosswaveB 1 Reply Last reply
                0
                • SplitMindGamingS SplitMindGaming

                  @bosswave yup that works. Thanks so much

                  bosswaveB Offline
                  bosswaveB Offline
                  bosswave
                  wrote on last edited by
                  #8

                  @SplitMindGaming Any time :)

                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Search