The Vector3 struct represents a point in 3D space. It is a fundamental type used in many 3D operations, providing a variety of methods and properties to manipulate and interact with 3D vectors.
The Vector3 struct represents a point in 3D space. It is a fundamental type used in many 3D operations, providing a variety of methods and properties to manipulate and interact with 3D vectors.
Member Name | Summary |
---|---|
One | A vector with all components set to 1. |
Zero | A vector with all components set to 0. |
Forward | A vector with X set to 1. This represents the forwards direction. |
Backward | A vector with X set to -1. This represents the backwards direction. |
Up | A vector with Z set to 1. This represents the upwards direction. |
Down | A vector with Z set to -1. This represents the downwards direction. |
Right | A vector with Y set to -1. This represents the right hand direction. |
Left | A vector with Y set to 1. This represents the left hand direction. |
Random | Uniformly samples a 3D position from all points with distance at most 1 from the origin. |
Abs | Returns a new vector with all values positive. -5 becomes 5, etc. |
Min | Returns the component-wise minimum of two vectors. |
Max | Returns the component-wise maximum of two vectors. |
Lerp | Linearly interpolates between two vectors. |
Slerp | Spherically interpolates between two vectors. |
Cross | Calculates the cross product of two vectors. |
Dot | Calculates the dot product of two vectors. |
DistanceBetween | Calculates the distance between two vectors. |
DistanceBetweenSquared | Calculates the squared distance between two vectors. |
InverseLerp | Calculates the inverse linear interpolation of a vector. |
Reflect | Reflects a vector off a surface defined by a normal. |
VectorPlaneProject | Projects a vector onto a plane defined by a normal. |
Sort | Sorts two vectors. |
CubicBezier | Calculates a point on a cubic Bezier curve. |
Direction | Calculates the direction from one vector to another. |
CatmullRomSpline | Calculates a point on a Catmull-Rom spline. |
TcbSpline | Calculates a point on a TCB spline. |
SmoothDamp | Smoothly dampens a vector towards a target. |
SpringDamp | Applies a spring damping effect to a vector. |
Parse | Parses a string into a Vector3. |
TryParse | Tries to parse a string into a Vector3. |
Member Name | Summary |
---|---|
x | The X component of this Vector. |
y | The Y component of this Vector. |
z | The Z component of this Vector. |
Normal | Returns a unit version of this vector. A unit vector has length of 1. |
IsNaN | Returns true if x, y or z are NaN. |
IsInfinity | Returns true if x, y or z are infinity. |
Length | Length (or magnitude) of the vector (Distance from 0,0,0). |
LengthSquared | Squared length of the vector. This is faster than Length, and can be used for things like comparing distances, as long as only squared values are used. |
IsNearZeroLength | Whether length of this vector is nearly zero. |
EulerAngles | The Euler angles of this direction vector. |
Inverse | Returns the inverse of this vector, which is useful for scaling vectors. |
Item | Accesses a component of the vector by index. |
WithX | Returns a new vector with the X component set to the specified value. |
WithY | Returns a new vector with the Y component set to the specified value. |
WithZ | Returns a new vector with the Z component set to the specified value. |
IsNearlyZero | Checks if the vector is nearly zero within a specified tolerance. |
ClampLength | Clamps the length of the vector to a specified maximum. |
Clamp | Clamps the vector between two other vectors. |
ComponentMin | Returns the component-wise minimum with another vector. |
ComponentMax | Returns the component-wise maximum with another vector. |
LerpTo | Linearly interpolates this vector towards another vector. |
SlerpTo | Spherically interpolates this vector towards another vector. |
Distance | Calculates the distance to another vector. |
DistanceSquared | Calculates the squared distance to another vector. |
Approach | Approaches a target vector by a specified amount. |
ProjectOnNormal | Projects this vector onto a normal. |
AlmostEqual | Checks if this vector is almost equal to another vector within a delta. |
SubtractDirection | Subtracts a direction vector scaled by a strength. |
SnapToGrid | Snaps this vector to a grid of a specified size. |
GetAngle | Calculates the angle between this vector and another vector. |
Angle | Calculates the angle to another vector. |
VectorAngle | Calculates the vector angle of this vector. |
AddClamped | Adds a vector to this vector, clamping the result to a maximum length. |
RotateAround | Rotates this vector around a center point by a specified rotation. |
WithAcceleration | Applies acceleration towards a target vector. |
WithFriction | Applies friction to this vector. |