KinematicBody move and move_and_slide difference in Godot 3.0

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By swipis
:warning: Old Version Published before Godot 3 was released.

Hello
I have a player (KinematicBody) and I trying to move it using move/move_and_slide, 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!

:bust_in_silhouette: Reply From: eons

move_and_slide takes the full velocity as parameter, don’t use the “delta” time with it.

Thank you eons now it works :slight_smile:

swipis | 2017-08-21 15:36