How to make 3D player to not slide downwards on any slope?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 20xxdd20

If I stand with my player on a #D slope, it will slide down slowly but I want it to stand still. How to do that?

:bust_in_silhouette: Reply From: psear

If you are using a kinematic body, you can either use move_and_collide() rather than move_and_slide() (remember you need to multiply by delta in move_and_collide()), or stop gravity from taking effect whenever your character is standing on a surface, for example:

if is_on_floor():
    velocity.y = 0
:bust_in_silhouette: Reply From: vnmk8

the move functions in KinematicBody such as move_and_slide() have an stop_on_slope argument, set it to true to enable it’s functionality
this is from the documentation:

Vector3 move_and_slide(linear_velocity: Vector3, up_direction: Vector3 = Vector3( 0, 0, 0 ), stop_on_slope: bool = false, max_slides: int = 4, floor_max_angle: float = 0.785398, infinite_inertia: bool = true)