Summary

A point in 3D space.

Constructors

Vector3 Initializes a vector with given components.

Properties

EulerAngles The Euler angles of this direction vector.
Inverse Returns the inverse of this vector, which us useful for scaling vectors.
IsInfinity Returns true if x, y or z are infinity
IsNaN Returns true if x, y or z are NaN
IsNearZeroLength Whether length of this vector is nearly zero.
Item
Length Length (or magnitude) of the vector (Distance from 0,0,0).
LengthSquared Squared length of the vector. This is faster than <see cref="P:Vector3.Length">Length</see>, and can be used for things like comparing distances, as long as only squared values are used.
Normal Returns a unit version of this vector. A unit vector has length of 1.
x The X component of this Vector.
y The Y component of this Vector.
z The Z component of this Vector.

Methods

Abs Returns a new vector with all values positive. -5 becomes 5, etc.
AddClamped Try to add to this vector. If we're already over max then don't add. If we're over max when we add, clamp in that direction so we're not.
AlmostEqual Returns true if we're nearly equal to the passed vector.
Angle Return the distance between the two direction vectors in degrees.
Approach Returns a new vector whose length is closer to given target length by given amount.
Clamp Returns a vector each axis of which is clamped to between the 2 given vectors. Basically clamps a point to an Axis Aligned Bounding Box (AABB).
ClampLength Returns a vector whose length is limited to given maximum.
ComponentMax Returns a vector that has the maximum values on each axis between this vector and given vector.
ComponentMin Returns a vector that has the minimum values on each axis between this vector and given vector.
Distance Returns distance between this vector to given vector.
DistanceSquared Returns squared distance between this vector to given vector. This is faster than <see cref="M:Vector3.Distance(Vector3@)">Distance</see>, and can be used for things like comparing distances, as long as only squared values are used.
IsNearlyZero Returns true if value on every axis is less than tolerance away from zero
LerpTo Performs linear interpolation between this and given vectors.
ProjectOnNormal Projects this vector onto another vector. Basically extends the given normal/unit vector to be as long as necessary to make a right triangle (a triangle which has a 90 degree corner) between (0,0,0), this vector and the projected vector.
RotateAround Rotate this vector around given point by given rotation and return the result as a new vector.<br /> See Transform.RotateAround(Vector3@,Rotation@) for similar method that also transforms rotation.
SlerpTo Performs spherical linear interpolation (Slerp) between this vector and a target vector.
SnapToGrid Snap to grid along any of the 3 axes.
SubtractDirection Given a vector like 1,1,1 and direction 1,0,0, will return 0,1,1. This is useful for velocity collision type events, where you want to cancel out velocity based on a normal. For this to work properly, direction should be a normal, but you can scale how much you want to subtract by scaling the direction. Ie, passing in a direction with a length of 0.5 will remove half the direction.
WithAcceleration Move to the target vector, by amount acceleration
WithFriction Apply an amount of friction to the current velocity.
WithX Returns this vector with given X component.
WithY Returns this vector with given Y component.
WithZ Returns this vector with given Z component.

Static Fields

Backward A vector with X set to -1. This represents the backwards direction.
Down A vector with Z set to -1. This represents the downwards direction.
Forward A vector with X set to 1. This represents the forwards direction.
Left A vector with Y set to 1. This represents the left hand direction.
One A vector with all components set to 1.
Right A vector with Y set to -1. This represents the right hand direction.
Up A vector with Z set to 1. This represents the upwards direction.
Zero A vector with all components set to 0.

Static Properties

Random Uniformly samples a 3D position from all points with distance at most 1 from the origin.

Static Methods

CatmullRomSpline Calculates a point on a Catmull-Rom spline given four control points and a parameter t.
Cross Returns the cross product of the 2 given vectors. If the given vectors are linearly independent, the resulting vector is perpendicular to them both, also known as a normal of a plane.
CubicBezier Calculates position of a point on a cubic beizer curve at given fraction.
Direction Calculates the normalized direction vector from one point to another in 3D space.
DistanceBetween Returns distance between the 2 given vectors.
DistanceBetweenSquared Returns squared distance between the 2 given vectors. This is faster than <see cref="M:Vector3.DistanceBetween(Vector3@,Vector3@)">DistanceBetween</see>, and can be used for things like comparing distances, as long as only squared values are used.
Dot Returns the scalar/dot product of the 2 given vectors.
GetAngle Return the distance between the two direction vectors in degrees.
InverseLerp Given a position, and two other positions, calculate the inverse lerp position between those
Lerp Performs linear interpolation between 2 given vectors.
Max Returns a vector that has the maximum values on each axis between the 2 given vectors.
Min Returns a vector that has the minimum values on each axis between the 2 given vectors.
Parse
Reflect Returns a reflected vector based on incoming direction and plane normal. Like a ray reflecting off of a mirror.
Slerp Performs spherical linear interpolation (Slerp) between two vectors.
SmoothDamp Smoothly move towards the target vector
Sort Sort these two vectors into min and max. This doesn't just swap the vectors, it sorts each component. So that min will come out containing the minimum x, y and z values.
SpringDamp Springly move towards the target vector
TcbSpline Calculates an interpolated point using the Kochanek-Bartels spline (TCB spline).
TryParse
VectorAngle Converts a direction vector to an angle.
VectorPlaneProject Projects given vector on a plane defined by <paramref name="planeNormal" />.
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.