# Vector3||doc136778

September 20, 2022

# Vector3

Three dimensional vector. This type is usually used to locate the position of the instance, the range of the region, and so on. It uses the X, y, and Z axes to locate the coordinates of an object in the world.

## Constructor

 `Vector3` Vector3.new( `float` x,  `float` y,  `float` z ) Create a 3D vector type data `Vector3` Vector3.new( `Vector3` vec ) Create a 3D vector type data

## Attribute

 `float` X 3D vector X axis `float` Y 3D vector Y axis `float` Z 3D vector Z axis `Vector3` Normalized [ReadOnly] Normalized vector of three-dimensional vector `float` Len [ReadOnly] Length of 3D vector

## Static properties

 `Vector3` Vector3.Zero [ReadOnly] Equivalent to vector3 new(0, 0, 0) `Vector3` Vector3.One [ReadOnly] Equivalent to vector3 new(1, 1, 1) `Vector3` Vector3.Forward [ReadOnly] Equivalent to vector3 new(0, 0, 1) `Vector3` Vector3.Left [ReadOnly] Equivalent to vector3 new(1, 0, 0) `Vector3` Vector3.Up [ReadOnly] Equivalent to vector3 new(0, 1, 0)

## Static function

 `Vector3` Vector3.Cross( `Vector3` vec1, `Vector3` vec2 ) Calculating the cross product of two vectors `float` Vector3.Dot( `Vector3` vec1, `Vector3` vec2 ) Calculating the dot product of two vectors `Vector3` Vector3.LookRotation( `Vector3` fromPos, `Vector3` facePos ) Calculates the rotation vector from one point to another `float` Vector3.AngleBetween( `Vector3` lookVec1, `Vector3` lookVec2 ) Calculate the angle between two vectors `float` Vector3.Distance( `Vector3` vec1, `Vector3` vec2 ) Calculate the distance between two vectors `Vector3` Vector3.ToLocalSpace( `MovableNode` targetNode, `Vector3` worldVec ) Convert a global vector to a local vector relative to an instance `Vector3` Vector3.ToWorldSpace( `MovableNode` targetNode, `Vector3` localVec ) Convert a local vector relative to an instance into a global vector `Vector3` Vector3.Lerp( `Vector3` fromVec, `Vector3` toVec, `float` time ) Calculate the linear interpolation between two vectors `Vector3` Vector3.MoveTowards( `Vector3` fromVec, `Vector3` toVec, `float` moveDistance ) Calculate the vector after a vector moves the specified distance to the target vector, and it will not exceed the target vector

## operation

 `Vector3` Vector3 + Vector3 Overloaded + operator plus another vector `Vector3` Vector3 – Vector3 Overloading the – sign operator, subtracting another vector `Vector3` Vector3 * number Overloaded * operator multiplied by a numeric value `Vector3` Vector3 / number Overloaded / operator, divided by a numeric value `Vector3` -Vector3 Overloaded symbolic operators, negating `bool` Vector3 == Vector3 Overloaded symbol operation to judge whether two vectors are equal `bool` Vector3 < Vector3 Overloaded symbol operation, vector 1 < vector 2 `bool` Vector3 <= Vector3 Overloaded symbol operation, vector 1 < = vector 2 `bool` Vector3 > Vector3 Overloaded symbol operation, vector 1 > vector 2 `bool` Vector3 >= Vector3 Overloaded symbol operation, vector 1 > = vector 2