struct Vector3

book_4_sparkGenerated
code_blocksInput

Description

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.

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.
MinReturns a vector with the minimum components of two vectors.
MaxReturns a vector with the maximum components of two vectors.
LerpLinearly interpolates between two vectors.
SlerpSpherically interpolates between two vectors.
InverseLerpCalculates the linear parameter t that produces the interpolant value within the range [a, b].
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.
ReflectReflects a vector off a surface defined by a normal.
VectorPlaneProjectProjects a vector onto a plane defined by a normal.
SortSorts two vectors by their components.
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 spring damping to a vector.
ParseParses a string into a Vector3.
TryParseTries to parse a string into a Vector3.
VectorAngleCalculates the angle of a vector.
GetAngleCalculates the angle between two vectors.

Instance Members

Member NameSummary
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 length.
ClampClamps the vector between two other vectors.
ComponentMinReturns a vector with the minimum components of this vector and another.
ComponentMaxReturns a vector with the maximum components of this vector and another.
LerpToLinearly interpolates this vector towards a target vector.
SlerpToSpherically interpolates this vector towards a target vector.
DistanceCalculates the distance to another vector.
DistanceSquaredCalculates the squared distance to another vector.
ApproachApproaches a target vector by a specified amount.
AbsReturns a new vector with all values positive.
ProjectOnNormalProjects this vector onto a normal.
AlmostEqualChecks if this vector is almost equal to another within a delta.
SubtractDirectionSubtracts a direction vector scaled by a strength.
SnapToGridSnaps this vector to a grid of specified size.
AddClampedAdds a vector to this one, clamping the result to a maximum length.
RotateAroundRotates this vector around a specified center and rotation.
WithAccelerationApplies acceleration towards a target vector.
WithFrictionApplies friction to this vector.
AngleCalculates the angle to another vector.

Properties

Property 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.
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.