Why use constrain attribute motion linear X instead of move command?
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
-
Icebox Posts: 1,485
In platform games, move doesnt work well with gravity. Here is an example
Move behavior
constrain motion linear velocity
-
Socks London, UK.Posts: 12,822
@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
Thank you very much! This explains!
Thank you for the explanation! Yes it makes a lot of sense now @Socks