struct Vector3

book_4_sparkGenerated
code_blocksInput

Description

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.

Members

Static Members

Member NameSummary
OneA vector with all components set to 1.
ZeroA vector with all components set to 0.
ForwardA vector with X set to 1. This represents the forwards direction.
BackwardA vector with X set to -1. This represents the backwards direction.
UpA vector with Z set to 1. This represents the upwards direction.
DownA vector with Z set to -1. This represents the downwards direction.
RightA vector with Y set to -1. This represents the right hand direction.
LeftA vector with Y set to 1. This represents the left hand direction.
RandomUniformly samples a 3D position from all points with distance at most 1 from the origin.
AbsReturns a new vector with all values positive. -5 becomes 5, etc.
MinReturns the component-wise minimum of two vectors.
MaxReturns the component-wise maximum of two vectors.
LerpLinearly interpolates between two vectors.
SlerpSpherically interpolates between two vectors.
CrossCalculates the cross product of two vectors.
DotCalculates the dot product of two vectors.
DistanceBetweenCalculates the distance between two vectors.
DistanceBetweenSquaredCalculates the squared distance between two vectors.
InverseLerpCalculates the inverse linear interpolation of a vector.
ReflectReflects a vector off a surface defined by a normal.
VectorPlaneProjectProjects a vector onto a plane defined by a normal.
SortSorts two vectors.
CubicBezierCalculates a point on a cubic Bezier curve.
DirectionCalculates the direction from one vector to another.
CatmullRomSplineCalculates a point on a Catmull-Rom spline.
TcbSplineCalculates a point on a TCB spline.
SmoothDampSmoothly dampens a vector towards a target.
SpringDampApplies a spring damping effect to a vector.
ParseParses a string into a Vector3.
TryParseTries to parse a string into a Vector3.

Instance Members

Member NameSummary
xThe X component of this Vector.
yThe Y component of this Vector.
zThe Z component of this Vector.
NormalReturns a unit version of this vector. A unit vector has length of 1.
IsNaNReturns true if x, y or z are NaN.
IsInfinityReturns true if x, y or z are infinity.
LengthLength (or magnitude) of the vector (Distance from 0,0,0).
LengthSquaredSquared 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.
IsNearZeroLengthWhether length of this vector is nearly zero.
EulerAnglesThe Euler angles of this direction vector.
InverseReturns the inverse of this vector, which is useful for scaling vectors.
ItemAccesses a component of the vector by index.
WithXReturns a new vector with the X component set to the specified value.
WithYReturns a new vector with the Y component set to the specified value.
WithZReturns a new vector with the Z component set to the specified value.
IsNearlyZeroChecks if the vector is nearly zero within a specified tolerance.
ClampLengthClamps the length of the vector to a specified maximum.
ClampClamps the vector between two other vectors.
ComponentMinReturns the component-wise minimum with another vector.
ComponentMaxReturns the component-wise maximum with another vector.
LerpToLinearly interpolates this vector towards another vector.
SlerpToSpherically interpolates this vector towards another vector.
DistanceCalculates the distance to another vector.
DistanceSquaredCalculates the squared distance to another vector.
ApproachApproaches a target vector by a specified amount.
ProjectOnNormalProjects this vector onto a normal.
AlmostEqualChecks if this vector is almost equal to another vector within a delta.
SubtractDirectionSubtracts a direction vector scaled by a strength.
SnapToGridSnaps this vector to a grid of a specified size.
GetAngleCalculates the angle between this vector and another vector.
AngleCalculates the angle to another vector.
VectorAngleCalculates the vector angle of this vector.
AddClampedAdds a vector to this vector, clamping the result to a maximum length.
RotateAroundRotates this vector around a center point by a specified rotation.
WithAccelerationApplies acceleration towards a target vector.
WithFrictionApplies friction to this vector.