godotengine / godotengine/godot-docs

CharacterBody2D move_and_slide() function inconsistency

Open
#6,592 5 comments 0 reactions 0 assignees View on GitHub
area:manual bug topic:physics
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** v4.0.beta11.official [91713ced8]

**Issue description:** `CharacterBody2D`'s `move_and_slide()` function inconsistency

**URL to the documentation page (if already existing):**

* https://docs.godotengine.org/en/latest/classes/class_characterbody2d.html#class-characterbody2d-method-move-and-slide
* https://docs.godotengine.org/en/latest/tutorials/physics/using_character_body_2d.html

A note that velocity is multiplied by delta automatically in `move_and_slide()` was removed from the [function's docs](https://docs.godotengine.org/en/latest/classes/class_characterbody2d.html#class-characterbody2d-method-move-and-slide) in 4.0:

> Moves the body based on velocity. If the body collides with another, it will slide along the other body (by default only on floor) rather than stop immediately. If the other body is a CharacterBody2D or RigidBody2D, it will also be affected by the motion of the other body. You can use this to make moving and rotating platforms, or to make nodes push other nodes.
>
> Modifies velocity if a slide collision occurred. To get the latest collision call get_last_slide_collision, for detailed information about collisions that occurred, use get_slide_collision.
>
> When the body touches a moving platform, the platform's velocity is automatically added to the body motion. If a collision occurs due to the platform's motion, it will always be first in the slide collisions.
>
> The general behavior and available properties change according to the motion_mode.
>
> Returns true if the body collided, otherwise, returns false.

but at the same time `Using Character2D` [tutorial page](https://docs.godotengine.org/en/latest/tutorials/physics/using_character_body_2d.html) still warns about it:

> move_and_slide() automatically calculates frame-based movement using delta. Do not multiply your velocity vector by delta before passing it to move_and_slide().

Which one is true? Should it be multiplied by delta or was it changed in 4.0?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.