0 votes

Hello
I have a player (KinematicBody) and I trying to move it using move/moveandslide, here is the code:

var speed = 30

player.move(parent.get_global_transform().basis.xform(Vector3(0, 0, -speed * delta)))

And player is moving normal as it should but I need that it can slide on collision so I tried:

player.move_and_slide(parent.get_global_transform().basis.xform(Vector3(0, 0, -speed * delta)))

But this time speed = 30 not enough to move player (speed = 3000 looks ok). Can someone to explain why is that or what I doing wrong?

Thank you in advance!

in Engine by (111 points)

1 Answer

0 votes

move_and_slide takes the full velocity as parameter, don't use the "delta" time with it.

by (7,946 points)

Thank you eons now it works :)

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.