The move_and_slide function is causing slight sliding when I run it. I know it’s the move_and_slide function after doing some debugging, because it only begins to change the positioning after the move_and_slide function runs.
It only changes the positioning of the player on the X and Z axes, and it only changes by a very minimal amount. To the point where the only way to tell it’s moving is through the use of print() statements or looking really closely at the pixels, but I could feel that something was off before I even realized the problem. So it isn’t a massive deal, but it makes the game feel janky and unfinished (which it is, but I’d like to solve this issue now rather than later.)
In most cases multiplying by delta for movement calculations makes sense, but move_and_slide() method is kinda an exception, because internally it uses the delta already, so there’s no need to multiply the velocity by delta yourself.
There is this proposal to externalize this calculation, so maybe in the future this will change.
A year late, but responding in case someone finds this through google search, too. I had a similar problem and fixed it by changing += to = (and removed delta as well).
So in line 90, instead of: velotitty += (
Try changing velotitty to velocity to refer to the attribute within the node component and += to just =, and remove line 106 since we won’t need to multiply by delta anyway: velocity = (
And hopefully that’ll fix the issue. Hope this helps someone!