The Vector3.Direction
method calculates the direction vector from one point to another in 3D space. This method is static and returns a normalized vector pointing from the from
vector to the to
vector.
The Vector3.Direction
method calculates the direction vector from one point to another in 3D space. This method is static and returns a normalized vector pointing from the from
vector to the to
vector.
To use the Vector3.Direction
method, provide two Vector3
references as parameters. The method will compute the direction from the first vector to the second vector and return it as a normalized Vector3
.
Vector3 pointA = new Vector3(1, 2, 3); Vector3 pointB = new Vector3(4, 5, 6); Vector3 direction = Vector3.Direction(ref pointA, ref pointB); // direction now holds the normalized vector pointing from pointA to pointB