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

    Changing screen rotation breaks some physics behaviours

    Scheduled Pinned Locked Moved
    Fixed
    4
    11
    444
    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.
    • Aidan_FireA
      Aidan_Fire
      last edited by

      Non beta latest version of hyperPad:
      In this example project, a red physics object with air resistance constantly propels itself forward, with a large green object in front of it. You would expect the red object to run into the green wall after a few seconds, but if you rotate the screen, the red object changes the direction it propels itself, and instead goes away from the green object when the screen rotates a full 180°.

      https://bit.ly/3hFrXJO

      bosswaveB 1 Reply Last reply Reply Quote 1
      • Aidan_FireA
        Aidan_Fire
        last edited by

        More than just physics, this includes move behaviours with duration more than 0 and even move screen behaviours.
        https://bit.ly/3jXFK09
        Logic in red square, the result seems wrong.

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

          @Aidan_Fire I noticed this as well. I’m working on a game with randomly generated levels and decided I’d set the screen rotation to a random angle during world generation and my player would not move in the correct direction.

          Hopefully this gets fixed lol

          1 Reply Last reply Reply Quote 0
          • RobinsonXR
            RobinsonX
            last edited by

            Wow, this is literally game breaking..

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

              @RobinsonX Almost. In most cases you can probably get around the problem by manually calculating anchors. I was using propel object for my Boat Racing game, instead of using propel object I'm now using sine and cosine of player angle and apply force, that still works. Just anchor based things are messed up.

              1 Reply Last reply Reply Quote 1
              • HamedH
                Hamed Admin
                last edited by Hamed

                I see how this is a problem for Propel and the move camera behaviours. Can you guys make a list of all the behaviours that are breaking when rotating screen?

                @bosswave how are you moving your player? I tried moving an object after rotating the screen and it moved as expected?

                bosswaveB Aidan_FireA 2 Replies Last reply Reply Quote 0
                • bosswaveB
                  bosswave @Hamed
                  last edited by

                  @Hamed My player consists of the main player object and a “thruster” object that’s attached to its back end. I use the thruster object to propel the main object forward.

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

                    @bosswave Same as mine then. This still works though: instead of propel object, get player rotation, get sine and cosine of the angle, multiply these both by the force you were using on propel object, then apply force x cosine y sine.

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

                      @Hamed said in Changing screen rotation breaks some physics behaviours:

                      Can you guys make a list of all the behaviours that are breaking when rotating screen?

                      -Screen moving and screen rotating at the same time over a duration other than 0 will cause the screen to end up in the wrong place

                      -Move behaviours seem to be ok

                      -Scree rotating will completely mess up propel object

                      I'll update this list if I happen to find more I guess.

                      1 Reply Last reply Reply Quote 0
                      • HamedH
                        Hamed Admin
                        last edited by

                        Screen rotation and screen moving at the same time makes sense why it’s not working as you’d expect and I don’t think it’s something fixable.

                        The problem is that when you’re moving the screen and rotate the screen, you’re rotating it about a point. Normally that point is in the centre of the screen so it rotates about the centre. But when you’re moving the screen, your centre keeps moving.

                        If you’d manually control this through your own timer, it would recalculate the centre every frame, and not calculate the position once.

                        1 Reply Last reply Reply Quote 1
                        • HamedH
                          Hamed Admin
                          last edited by

                          Fixed for propel objects.

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