Vector3
The Vector3 data type represents a vector in 3D space, typically usually used as a point in 3D space or the dimensions of a rectangular prism. Vector3 supports basic component-based arithmetic operations (sum, difference, product, and quotient) and these operations can be applied on the left or right hand side to either another Vector3 or a number. It also features methods for common vector operations, such as Cross() and Dot().
Some example usages of Vector3 are the Position, Rotation, and Size of parts, for example:
local part = workspace.Partpart.Position = part.Position + Vector3.new(5, 2, 10) -- Move part by (5, 2, 10)
Vector3 is also commonly used when constructing more complex 3D data types such as CFrame. Many of these data types' methods will use a Vector3 within their parameters, such as CFrame:PointToObjectSpace().
Résumé
Constructeurs
- FromNormalId(normal : Enum.NormalId)
Propriétés
A Vector3 with a magnitude of zero.
A Vector3 with a value of 1 on every axis.
A Vector3 with a value of 1 on the X axis.
A Vector3 with a value of 1 on the Y axis.
A Vector3 with a value of 1 on the Z axis.
The x-coordinate of the Vector3.
The y-coordinate of the Vector3.
The z-coordinate of the Vector3.
The length of the Vector3.
A normalized copy of the Vector3 - one that has the same direction as the original but a magnitude of 1.
Méthodes
Returns a new vector from the absolute values of the original's components.
Returns a new vector from the ceiling of the original's components.
Returns a new vector from the floor of the original's components.
Returns a new vector from the sign (-1, 0, or 1) of the original's components.
Returns the cross product of the two vectors.
Returns the angle in radians between the two vectors. If you provide an axis, it determines the sign of the angle.
Returns a scalar dot product of the two vectors.
Returns true if the X, Y, and Z components of the other Vector3 are within epsilon units of each corresponding component of this Vector3.
Returns a Vector3 linearly interpolated between this Vector3 and the given goal by the given alpha.
Returns a Vector3 with each component as the highest among the respective components of both provided Vector3 objects.
Returns a Vector3 with each component as the lowest among the respective components of both provided Vector3 objects.