Changing screen rotation breaks some physics behaviours

  • 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°.

  • More than just physics, this includes move behaviours with duration more than 0 and even move screen behaviours.

    Logic in red square, the result seems wrong.

  • @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

  • Wow, this is literally game breaking..

  • @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.

  • Admin

    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?

  • @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.

  • @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.

  • @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.

  • Admin

    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.

  • Admin

    Fixed for propel objects.

Log in to reply