E.G.

```
func _physics_process(delta):
position += Vector2(1, 1).normalized() * velocity * delta
```

What does that .normalized() do? everyone says its setting a vector's length to 1. But what does that mean?

+1 vote

Best answer

You can picture a vector as an arrow, pointing in some direction and having some length.

The vector `(1, 1)`

has a length of `1.414`

(by the Pythagorean theorem). Normalizing this vector sets its length to `1`

, so the vector becomes `(0.7071, 0.7071)`

.

Normalized vectors, since they have a length of `1`

are very useful for representing directions, and you can then multiply them by any number to scale them to any length you need, such as the `velocity`

length in the example you posted.

More details at the helpful docs link here:

https://docs.godotengine.org/en/stable/tutorials/math/vector_math.html

- All categories
- Engine 30,404