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. Comments & Feedback
  3. Lock object movement on X or Y axis

Lock object movement on X or Y axis

Scheduled Pinned Locked Moved Comments & Feedback
suggestion
16 Posts 3 Posters 2.6k 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.
  • KamdroidK Kamdroid

    I’m making a game where I give the illusion of the camera movement by having obstacles move towards the player, however eventually the character will accidentally move on the X axis, ruining the experience.

    This can be easily solved by giving an option to lock an object’s X or Y axis movement.

    D Offline
    D Offline
    Deeeds
    wrote on last edited by
    #2

    @Kamdroid I've seen this somewhere. And I think I use it something I built for a camera dummy a while back... it might be a behaviour.

    D 1 Reply Last reply
    0
    • D Deeeds

      @Kamdroid I've seen this somewhere. And I think I use it something I built for a camera dummy a while back... it might be a behaviour.

      D Offline
      D Offline
      Deeeds
      wrote on last edited by
      #3

      @Deeeds Found it. It's in "Screen Follow" behaviour, Under Screen Behaviours.

      You can lock to one of the axis.

      D 1 Reply Last reply
      0
      • D Deeeds

        @Deeeds Found it. It's in "Screen Follow" behaviour, Under Screen Behaviours.

        You can lock to one of the axis.

        D Offline
        D Offline
        Deeeds
        wrote on last edited by Deeeds
        #4

        @Kamdroid btw, if you're moving something to make a fake/dummy object for you camera to follow, so you can do delays of the camera and fake lerping (which I am) then do your update on Timer set at:

        0.016666666666

        This is 1/60th of a second, or thereabouts

        with as many 6's as you can be bothered typing.

        This got rid of a weird set of vibrations and other stuttering that was very fast but visible when I had this set to 0.

        I would not have thought this would make a difference, assuming that 0 was equivalent to 0.016666, but it's obviously not.

        D 1 Reply Last reply
        0
        • D Deeeds

          @Kamdroid btw, if you're moving something to make a fake/dummy object for you camera to follow, so you can do delays of the camera and fake lerping (which I am) then do your update on Timer set at:

          0.016666666666

          This is 1/60th of a second, or thereabouts

          with as many 6's as you can be bothered typing.

          This got rid of a weird set of vibrations and other stuttering that was very fast but visible when I had this set to 0.

          I would not have thought this would make a difference, assuming that 0 was equivalent to 0.016666, but it's obviously not.

          D Offline
          D Offline
          Deeeds
          wrote on last edited by
          #5

          @Kamdroid

          One more thing...

          when updating your camera dummy, don't just adjust its position, also update its velocity. This will get rid of the little lag that occurs where the engine has to accelerate your object after moving it to the new position, which seems to be a frame or two behind the positional change, always. Most noticeable in very high speed stuff. This has completely gotten rid of the lag.

          Or... use a Weld behaviour and make sure your dummy has absolutely no mass and no friction, and then move it relative to your object whenever you want by changing the anchor position.

          These are some of the quirks and foibles I've worked around within hyperPad cameras and dummy objects. I hope they help. It took me a couple of days to iron out all the kinks in the camera follow system I made... but for one... still got a little lerping fake that's got a bit of a jump in it that I don't like, but I'll leave that for later.

          1 Reply Last reply
          0
          • KamdroidK Offline
            KamdroidK Offline
            Kamdroid
            wrote on last edited by
            #6

            @Deeeds I’m aware of this, but the character is not followed by a camera.

            The player always need to have an X of 6, (the only thing that should be moving is the Y, for jumping),

            While obaticals spawn at X 36 (right edge of screen) and move to the left (towards player), and you tap to jump to avoid the obstical etc

            D Aidan_FireA 2 Replies Last reply
            0
            • KamdroidK Kamdroid

              @Deeeds I’m aware of this, but the character is not followed by a camera.

              The player always need to have an X of 6, (the only thing that should be moving is the Y, for jumping),

              While obaticals spawn at X 36 (right edge of screen) and move to the left (towards player), and you tap to jump to avoid the obstical etc

              D Offline
              D Offline
              Deeeds
              wrote on last edited by
              #7

              @Kamdroid
              DOH. Don't know ....

              1 Reply Last reply
              0
              • KamdroidK Kamdroid

                @Deeeds I’m aware of this, but the character is not followed by a camera.

                The player always need to have an X of 6, (the only thing that should be moving is the Y, for jumping),

                While obaticals spawn at X 36 (right edge of screen) and move to the left (towards player), and you tap to jump to avoid the obstical etc

                Aidan_FireA Offline
                Aidan_FireA Offline
                Aidan_Fire
                wrote on last edited by
                #8

                @Kamdroid So your player is a physics object right? I don’t know how well it would work, but you could try running a 0 second timer with Set Velocity, leaving Y as current and X as 0. Haven’t tried it, it might not work. It would depend on the controls of the player and what the player is doing exactly.

                KamdroidK 1 Reply Last reply
                0
                • Aidan_FireA Aidan_Fire

                  @Kamdroid So your player is a physics object right? I don’t know how well it would work, but you could try running a 0 second timer with Set Velocity, leaving Y as current and X as 0. Haven’t tried it, it might not work. It would depend on the controls of the player and what the player is doing exactly.

                  KamdroidK Offline
                  KamdroidK Offline
                  Kamdroid
                  wrote on last edited by
                  #9

                  @Aidan-Oxley Thanks, this works. I was thinking of doing this but got mixed up with apply force, and thought this wouldn’t work.

                  I will use this for now, but I feel inefficient, as directly talking to the physics engines to do this would yield less of a performance impact.

                  Aidan_FireA 1 Reply Last reply
                  0
                  • KamdroidK Kamdroid

                    @Aidan-Oxley Thanks, this works. I was thinking of doing this but got mixed up with apply force, and thought this wouldn’t work.

                    I will use this for now, but I feel inefficient, as directly talking to the physics engines to do this would yield less of a performance impact.

                    Aidan_FireA Offline
                    Aidan_FireA Offline
                    Aidan_Fire
                    wrote on last edited by
                    #10

                    @Kamdroid Nice! I guess with efficiency, I’d just wanna make sure that the FPS is always at 60.

                    1 Reply Last reply
                    0
                    • KamdroidK Offline
                      KamdroidK Offline
                      Kamdroid
                      wrote on last edited by
                      #11

                      By the way, this is the game I was talking about, which I just released now!

                      https://www.hyperpad.com/projects/aubjkay_/versions/bounce-tap

                      D 1 Reply Last reply
                      1
                      • KamdroidK Kamdroid

                        By the way, this is the game I was talking about, which I just released now!

                        https://www.hyperpad.com/projects/aubjkay_/versions/bounce-tap

                        D Offline
                        D Offline
                        Deeeds
                        wrote on last edited by
                        #12

                        @Kamdroid WELL DONE!!!

                        KamdroidK 1 Reply Last reply
                        0
                        • D Deeeds

                          @Kamdroid WELL DONE!!!

                          KamdroidK Offline
                          KamdroidK Offline
                          Kamdroid
                          wrote on last edited by
                          #13

                          @Deeeds Thank you. Do you get any stutter while playing?

                          D 1 Reply Last reply
                          0
                          • KamdroidK Kamdroid

                            @Deeeds Thank you. Do you get any stutter while playing?

                            D Offline
                            D Offline
                            Deeeds
                            wrote on last edited by
                            #14

                            @Kamdroid Haven't played it yet. I was congratulating you on getting finished. That's rare!

                            KamdroidK 1 Reply Last reply
                            0
                            • D Deeeds

                              @Kamdroid Haven't played it yet. I was congratulating you on getting finished. That's rare!

                              KamdroidK Offline
                              KamdroidK Offline
                              Kamdroid
                              wrote on last edited by
                              #15

                              @Deeeds Oh, haha. I always get projects done if I’m happy with how the quality of the game and gameplay will be.

                              D 1 Reply Last reply
                              0
                              • KamdroidK Kamdroid

                                @Deeeds Oh, haha. I always get projects done if I’m happy with how the quality of the game and gameplay will be.

                                D Offline
                                D Offline
                                Deeeds
                                wrote on last edited by
                                #16

                                @Kamdroid Again, WELL DONE! I'll get to it soon. Promise. Sorry I haven't had a chance yet.... fighting with spawning and "relationships" in hyperPad's worlds without them.

                                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