godotengine / godotengine/godot-docs

Physics introduction: should you multiply velocity by delta before calling move_and_slide() or not?

Open
#7,607 3 comments 0 reactions 0 assignees View on GitHub
area:manual enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**stable (4.0)**

**Issue description:** there is a warning in the docs that states: `move_and_slide()` automatically includes the timestep in its calculation, so you should not multiply the velocity vector by `delta`., but the code that follows seems to do the opposite. As a beginner I find it a bit confusing.
The piece of code that puzzles me is:
```
func _physics_process(delta):
velocity.y += gravity * delta
get_input()
move_and_slide()
```
Why `gravity` is multiplied by `delta`?

**URL to the documentation page (if already existing):** [link](https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html)

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.