Vector3
Representation of 3D vectors and points. Unity Vector3
Members
Properties
Name | Description |
---|---|
Vector3 .magnitude | Returns the length of this vector (Read Only). |
Vector3 .normalized | Returns this vector with a magnitude of 1 (Read Only). |
Vector3 .sqrMagnitude | Returns the squared length of this vector (Read Only). |
Vector3 .x | X component of the vector. |
Vector3 .y | Y component of the vector. |
Vector3 .z | Z component of the vector. |
Static Properties
Name | Description |
---|---|
Vector3 .back | Shorthand for writing Vector3(0, 0, -1). |
Vector3 .down | Shorthand for writing Vector3(0, -1, 0). |
Vector3 .forward | Shorthand for writing Vector3(0, 0, 1). |
Vector3 .left | Shorthand for writing Vector3(-1, 0, 0). |
Vector3 .negativeInfinity | Shorthand for writing Vector3(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity). |
Vector3 .one | Shorthand for writing Vector3(1, 1, 1). |
Vector3 .positiveInfinity | Shorthand for writing Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity). |
Vector3 .right | Shorthand for writing Vector3(1, 0, 0). |
Vector3 .up | Shorthand for writing Vector3(0, 1, 0). |
Vector3 .zero | Shorthand for writing Vector3(0, 0, 0). |
Constructor
Name | Description |
---|---|
Vector3(x, y, z) | Creates a new vector with given x, y, z components. |
Methods
Name | Description |
---|---|
Vector3 .Set(newX, newY, newZ) | Set x, y and z components of an existing Vector3. |
Static Methods
Name | Description |
---|---|
Vector3 .Angle(from, to) | Returns the angle in degrees between from and to . |
Vector3 .ClampMagnitude(vector, maxLength) | Returns a copy of vector with its magnitude clamped to maxLength. |
Vector3 .Cross(lhs, rhs) | Cross Product of two vectors. |
Vector3 .Distance(a, b) | Returns the distance between a and b. |
Vector3 .Dot(lhs, rhs) | Dot Product of two vectors. |
Vector3 .Lerp(a, b, t) | Linearly interpolates between two points. |
Vector3 .LerpUnclamped(a, b, t) | Linearly interpolates between two vectors. |
Vector3 .Max(lhs, rhs) | Returns a vector that is made from the largest components of two vectors. |
Vector3 .Min(lhs, rhs) | Returns a vector that is made from the smallest components of two vectors. |
Vector3 .MoveTowards(current, target, maxDistanceDelta) | Calculate a position between the points specified by current and target, moving no farther than the distance specified by maxDistanceDelta. |
Vector3 .Normalize(value) | Makes this vector have a magnitude of 1. |
Vector3 .Project(vector, onNormal) | Projects a vector onto another vector. |
Vector3 .Reflect(inDirection, inNormal) | Reflects a vector off the plane defined by a normal. |
Vector3 .RotateTowards(current, target, maxRadiansDelta, maxMagnitudeDelta) | Rotates a vector current towards target. |
Vector3 .Scale(a, b) | Multiplies two vectors component-wise. |
Vector3 .SignedAngle(from, to, axis) | Returns the signed angle in degrees between from and to. |
Vector3 .Slerp(a, b, t) | Spherically interpolates between two vectors. |
Vector3 .SlerpUnclamped(a, b, t) | Spherically interpolates between two vectors. |
Operators
Name | Description |
---|---|
Operator (Vector3-Vector3) | Subtracts one vector from another. |
| Unary Operator (-Vector3) | Negates a vector. Each component in the result is negated. |
| Operator (Vector3~=Vector3) | Returns true if vectors are different. Very close vectors are treated as being equal. |
| Operator (Vector3*number) | Multiplies a vector by a number. |
| Operator (number*Vector3) | Multiplies a vector by a number. |
| Operator (Vector3/number) | Divides a vector by a number. |
| Operator (Vector3+Vector3) | Adds two vectors. |
| Operator (Vector3==Vector3) | Returns true if two vectors are approximately equal. |