0 votes

Hello! Does anybody by any chance know how to apply sliding for Rigidbodies that works similar to "move_and_slide()" function in the KinematicBody Node? I would like to make the object not stick to walls like as if it was a spider on a wall, and walking up
slopes without issue.

Here is the code to make it move left or right, it works for Rigidbody:

func _sideway_motion(d):
    var velocity = get_linear_velocity()
    var sideways = get_global_transform().basis.x
    if Input.is_action_pressed("ui_left"):
        velocity -= sideways * force
        direction = "left"
    elif Input.is_action_pressed("ui_right"):
        velocity += sideways * force
        direction = "right"
        velocity = get_linear_velocity()

    velocity *= dampen
in Engine by (208 points)
edited by

RigidBody suppose to use forces, and all the calculations of movements and such are behind the scene for all that i know

Please log in or register to answer this question.

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.