Obtaining Vectors

There are different ways to obtain a vector.

First is by using the toVector method on a location. This will use the coordinates from that location and form a vector with the values. Second is the getDirection method on a location as well. This one is a bit more abstract because not every location always has a meaningful direction. For example the location of a block in a world doesn't have any direction. Instead locations obtained from entities (like players) contain information where the player is looking at. A direction vector will always be a unit-vector.

A unit-vector is a vector with a length of 1. Any vector can become a unit-vector by normalizing it. Unit-Vectors are special when used in context with other operations like for example the dot product.

purple = toVector on player location orange = getDirection on player location

Third is creating vectors yourself. Sometimes you need to create vectors yourself as well.

Last updated