Move_and_slide is causing my player to float

JicaiyaRJicaiyaR Posts: 2Unconfirmed Member

This line of code " velocity = move_and_slide(velocity, Vector3.UP)" alone is causing my player model to float above the ground. Disabling this line brings the player back down. Everything else works as normal I just can't figure out why this is happening or how to fix it.


  • MegalomaniakMegalomaniak Posts: 4,822Admin
    This discussion was caught in the moderation queue since you have not confirmed your account yet.
    Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.
    If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile:
  • cyberealitycybereality Posts: 5,341Moderator

    Move and slide doesn't deal with gravity. Keeping a character on the floor is your responsibility. For example, if the velocity vector you are passing into move and slide is not directly parallel to the ground (or slightly down) then the character will float (without accounting for gravity calculations in your own code).

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file