Forum rules - please read before posting.

Direct control problem- Player moves vertically when turning

Hi, I'm a new face of AC, Unity and scripting. I was following AC 2D game tutorial and I want to use Direct Control to move unlike the tutorial, so I changed it on AC Game Editor.

However, strange thing happened. When the player turned left to right or right to left, the player moved vertically. I've tried to move and turn up to down and down to up though, conversely the player moved horizontally.

https://youtu.be/nuTXOGcwR4U

How do I turn off this movement? It's not good for a 2D platform game like my game, I want to turn off it or lock vertical movement.
And Unity Version is 2019.1.14f1 and AC version is v1.69.2

Thanks!

Comments

  • edited October 2019

    Welcome to the community, @laskow.

    2D games in AC typically allow movement both horizontally and vertically (in screen space) - as covered by the 2D Demo and tutorial.

    However, you have a couple of ways to get around this issue:

    1. Check Turn instantly when under player control? under the Settings Manager's "Movement settings" section. This will prevent left/right movements causing them to face up/down when turning.
    2. Attach a Rigidbody2D component if your Player doesn't already have one, and freeze the Y position in its Inspector. You'll also have to check Move with Rigidbody 2D? in the Player component's Inspector. This will prevent them from moving vertically at all, even if you use the Vertical input axis.

    Also, your player's origin should be at their feet - not at the centre of their body. Make sure that the sprites have their pivot point set to the centre bottom, and that the sprite child's local position is (0,0,0). See the 2D Demo's Brain2D player prefab for an example, and the "Character animation (Sprites Unity)" Manual chapter for more details.

  • Hello, Chris. Thanks for your reply.

    First I checked Turn instantly when under player control, and then bobbling is stopped!! I have been tried to solve this thing for 2 weeks, then finally it's solved :D I checked freeze the Y position and Move with Rigidbody 2D just in case, also I changed sprites pivot.

    Super thank you for helping me!!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.