Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Overlap object detection is bugged or not working

    Help
    3
    7
    320
    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.
    • The_True_Odst
      The True ODST Best Forum Helpers last edited by

      70f1ce7b-cb55-4ce9-b565-ea8e1cfcf9df-image.png

      I made sure both the player and the rope is present and named correctly

      https://play.creaticode.com/projects/6750e68aa80eece3de43d381

      ODST: Orbital Drop Ship Trooper
      (Halo Reference)

      Tyller_ 1 Reply Last reply Reply Quote 1
      • Tyller_
        Tyller_ Best Forum Helpers @The_True_Odst last edited by Tyller_

        @011830-0a42ef84 is non blocking collision turned on for both?

        edit: I had looked over and is player the yellow box or is the avatar the player, if the avatar is the player object then that’s why

        <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
        </div>

        The_True_Odst 1 Reply Last reply Reply Quote 1
        • The_True_Odst
          The True ODST Best Forum Helpers @Tyller_ last edited by

          @tyller_ I’m not sure what you mean. How do I detect collision with the rope so it can actually climb it?

          ODST: Orbital Drop Ship Trooper
          (Halo Reference)

          Tyller_ info-creaticode 2 Replies Last reply Reply Quote 0
          • Tyller_
            Tyller_ Best Forum Helpers @The_True_Odst last edited by

            @011830-0a42ef84 is the player object (object with label player) the avatar or the yellow box, if it’s the avatar then the reason you can’t detect it is because both the rope and player have collision, so they collide with each other and can never overlap, overlap means they’re inside each other’s colliders, if the yellow box is labeled player then try turning on non blocking collision on that (and shrink it so the player can’t climb ropes from too far)

            <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
            </div>

            1 Reply Last reply Reply Quote 1
            • info-creaticode
              CreatiCode @The_True_Odst last edited by

              @011830-0a42ef84

              The 2 objects, “player” and “rope,” are not in the same sprite, so when you run this “overlapping” block in the player sprite, it doesn’t know about the “rope” object. That’s why it is not working.

              Also, testing for objects overlapping frame by frame is very expensive. Since you already know the position of the rope, it is much simpler to check the distance between the player and the rope. You only need to calculate the 2D distance between them, and if it is a small number, then you know the player is very close to the rope.

              Also, the way you handle the key presses is not optimal. For example, in “when w key pressed”, you have the block to wait until key w is pressed or the object is blocked below. But when the w key is pressed again, this stack will be triggered again. Overall, this will make the project run slowly and not smoothly. Instead, we recommend you use a single forever loop to handle all keys and conditions, but each key press is handled instantly. You can check out this project for an example: play.creaticode.com/projects/66e823b5a634f8ee7d92cc88/editor?version=1

              The_True_Odst 1 Reply Last reply Reply Quote 1
              • The_True_Odst
                The True ODST Best Forum Helpers @info-creaticode last edited by

                @info-creaticode

                When I use the distance between block, it doesn’t change value no matter where the player moves and just stays at the value 100000000.

                ODST: Orbital Drop Ship Trooper
                (Halo Reference)

                info-creaticode 1 Reply Last reply Reply Quote 0
                • info-creaticode
                  CreatiCode @The_True_Odst last edited by

                  @011830-0a42ef84

                  Please refer to this example:

                  play.creaticode.com/projects/675378ad977fa780536fd819

                  The idea is that we already know the position of the rope, then we just need to know the position of the player, then calculate the direct distance between these 2 2D coordinates.

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