Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CharacterBody2D template uses move_toward incorrectly #74216

Open
ghost opened this issue Mar 2, 2023 · 1 comment · May be fixed by #73873 or #92398
Open

CharacterBody2D template uses move_toward incorrectly #74216

ghost opened this issue Mar 2, 2023 · 1 comment · May be fixed by #73873 or #92398

Comments

@ghost
Copy link

ghost commented Mar 2, 2023

Godot version

4.0 stable

System information

win 11

Issue description

If you select the CharacterBody2D template, you get this line:

velocity.x = move_toward(velocity.x, 0, SPEED)

However, the docs say that the third parameter is delta. This means that velocity.x is set to 0 immediately since it can't be any greater than SPEED. The line could be replaced by velocity.x = 0.

I think the line should be replaced by velocity.x = move_toward(velocity.x, 0, SPEED * delta), right?

Also, someone on Discord confused the delta of the move_toward function with the _physics_process delta. Perhaps the docs should clarify that they're not the same and that delta just means change?

Steps to reproduce

Make a CharacterBody2D with the default template for it.

Minimal reproduction project

N/A

@akien-mga
Copy link
Member

Should be fixed by #73873.

@akien-mga akien-mga modified the milestones: 4.x, 4.1 Mar 2, 2023
@akien-mga akien-mga linked a pull request Mar 2, 2023 that will close this issue
2 tasks
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@AThousandShips AThousandShips modified the milestones: 4.2, 4.3 Oct 30, 2023
@AThousandShips AThousandShips modified the milestones: 4.3, 4.4 Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants