The Vector3 struct represents a point in 3D space, providing various methods and properties to manipulate and interact with 3D vectors. It is a fundamental type used in 3D graphics and physics calculations.
The Vector3 struct represents a point in 3D space, providing various methods and properties to manipulate and interact with 3D vectors. It is a fundamental type used in 3D graphics and physics calculations.
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. |
Min | Returns a vector with the minimum components of two vectors. |
Max | Returns a vector with the maximum components of two vectors. |
Lerp | Linearly interpolates between two vectors. |
Slerp | Spherically interpolates between two vectors. |
InverseLerp | Calculates the linear parameter t that produces the interpolant value within the range [a, b]. |
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. |
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 by their components. |
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 spring damping to a vector. |
Parse | Parses a string into a Vector3. |
TryParse | Tries to parse a string into a Vector3. |
VectorAngle | Calculates the angle of a vector. |
GetAngle | Calculates the angle between two vectors. |
Member Name | Summary |
---|---|
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 length. |
Clamp | Clamps the vector between two other vectors. |
ComponentMin | Returns a vector with the minimum components of this vector and another. |
ComponentMax | Returns a vector with the maximum components of this vector and another. |
LerpTo | Linearly interpolates this vector towards a target vector. |
SlerpTo | Spherically interpolates this vector towards a target 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. |
Abs | Returns a new vector with all values positive. |
ProjectOnNormal | Projects this vector onto a normal. |
AlmostEqual | Checks if this vector is almost equal to another within a delta. |
SubtractDirection | Subtracts a direction vector scaled by a strength. |
SnapToGrid | Snaps this vector to a grid of specified size. |
AddClamped | Adds a vector to this one, clamping the result to a maximum length. |
RotateAround | Rotates this vector around a specified center and rotation. |
WithAcceleration | Applies acceleration towards a target vector. |
WithFriction | Applies friction to this vector. |
Angle | Calculates the angle to another vector. |
Property 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. |
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. |