I have a question about move_and_slide parameter!

oldSkoololdSkool Posts: 31Member

hello, for the move_and_slide parameter, i don't seem to get the Vector2.UP I know the value is x =0 and y = 1 but what does that do for the move left and right? I know that when you change the UP to down, left, or right, i can't jump. could it be that the enum will determine if you can jump up or right or left but i dont want to assume anything. and then there the zero? can someone explain. thank you


  • cyberealitycybereality Posts: 927Moderator

    It lets the engine know where the floor is supposed to be. It should typically just be the Vecor2.UP or Vector3.UP unless you are doing something weird and need custom gravity directions.

  • oldSkoololdSkool Posts: 31Member

    for vector2, x pointing right is positive and left is negative, as for y point up is -1 and down is positive. so how is Vector2.UP is the floor. can someone exaggerate some more?

  • SIsilicon28SIsilicon28 Posts: 715Moderator

    The up vector represents the general normal of floors in your game, but you can also think of it as a vector that's opposite to the body's gravity direction.

  • cyberealitycybereality Posts: 927Moderator

    Sorry, I should have been more clear. The parameter is the floor normal, as @SIsilicon28 says.

Sign In or Register to comment.