Why use constrain attribute motion linear X instead of move command?

indra.azizindra.aziz Member Posts: 102

Hey everyone,

I watched a tutorial on making a platformer game Danger Droid, I think it was from @jamie_c. In the tutorial, Jamie used constrain attribute motion linear X instead of move command to move the player. Why is that and how are they different from each other?

Thank you!

Best Answers

  • IceboxIcebox Posts: 1,485
    Accepted Answer

    In platform games, move doesnt work well with gravity. Here is an example

    Move behavior

    constrain motion linear velocity

  • SocksSocks London, UK.Posts: 12,822
    edited May 2017 Accepted Answer

    @indra.aziz said:
    Thank you very much! This explains!

    To add to what Iecbox has already said . . . the Move behaviour is two dimensional, it imparts an X and Y movement on the actor, even if the actor is moving at 300pps in the 0° direction it will still be using two vectors (X = 300, Y = 0)

    Whereas Linear-Velocity-X (or Y) is linear (one dimensional).

    This means if you were to use Move to move horizontally (left to right for example) then when you add in another behaviour to move vertically (for example a jump) it clashes with the vertical movement in the Move behaviour (which is speed 0) . . . . you are telling your actor to move upwards with the jump at the same time as the Move behaviour is telling the actor that the Y movement speed should be 0.

    Hope that makes sense !

    tl;dr Move moves things in both X and Y at the same time (even when travelling at 0° or 90° etc), whereas with Linear Velocity you have independent control over X and Y.

Answers

Sign In or Register to comment.