godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

Documentation for `move_and_slide()` function in `CharacterBody2D` doesn't specify `delta` is not needed.

Open TheSofox opened this issue 4 months ago • 0 comments

4.3 Stable

This issue was brought up in a Reddit thread: https://www.reddit.com/r/godot/comments/1fv3d6g/it_bothers_me_how_something_so_important_about/

Simply put, according to here: https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html#move-and-slide move_and_slide() automatically includes the timestep in its calculation, so you should not multiply the velocity vector by delta. This does not apply to gravity as it is an acceleration and is time dependent, and needs to be scaled by delta.

However, this is not mentioned in the function documentation, which is probably one of the most important places it should be mentioned: https://docs.godotengine.org/en/stable/classes/class_characterbody2d.html#class-characterbody2d-method-move-and-slide

And it's also not mentioned in the Using CharacterBody2D/3D https://docs.godotengine.org/en/stable/tutorials/physics/using_character_body_2d.html#move-and-slide (not the previous section mentions delta use for move_and_collide(), but not mentioned at all for move_and_slide()

TheSofox avatar Oct 03 '24 13:10 TheSofox