0 votes

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?

Godot version 3.3.2
in Engine by (56 points)

2 Answers

0 votes

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
by (276 points)
0 votes

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)
by (454 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.