A point in 3D space.
Initializes a vector with given components.
Initializes a vector with given components and Z set to 0.
Initializes a vector3 from given vector2 and the given Z component.
Initializes the vector with all components set to given value.
A vector with X set to -1. This represents the backwards direction.
Returns a new vector with each component randomized between -1 and 1.
The Euler angles of this direction vector.
Returns true if x, y or z are NaN
Whether length of this vector is nearly zero.
Length (or magnitude) of the vector (Distance from 0,0,0).
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.
The X component of this Vector.
The Y component of this Vector.
The Z component of this Vector.
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.
Calculates position of a point on a cubic beizer curve at given fraction.
Returns distance between the 2 given vectors.
Returns squared distance between the 2 given vectors. This is faster than DistanceBetween, and can be used for things like comparing distances, as long as only squared values are used.
Return the distance between the two direction vectors in degrees.
Performs linear interpolation between 2 given vectors.
Performs linear interpolation between 2 given vectors, with separate fraction for each vector component.
Returns a vector that has the maximum values on each axis between the 2 given vectors.
Returns a vector that has the minimum values on each axis between the 2 given vectors.
Given a string, try to convert this into a vector. Example input formats that work would be "1,1,1", "1;1;1", "[1 1 1]".
This handles a bunch of different separators ( ' ', ',', ';', '\n', '\r' ).
It also trims surrounding characters ('[', ']', ' ', '\n', '\r', '\t', '"').
Returns a reflected vector based on incoming direction and plane normal. Like a ray reflecting off of a mirror.
Smoothly move towards the target vector
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.
Converts a direction vector to an angle.
Projects given vector on a plane defined by planeNormal
.
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.
Returns true if we're nearly equal to the passed vector.
Returns a new vector whose length is closer to given target length by given amount.
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).
Returns a vector each axis of which is clamped to given min and max values.
Returns a vector whose length is limited to given maximum.
Returns a vector whose length is limited between given minimum and maximum.
Returns a vector that has the maximum values on each axis between this vector and given vector.
Returns a vector that has the minimum values on each axis between this vector and given vector.
Returns the cross product of this and the given vector. If this and the given vectors are linearly independent, the resulting vector is perpendicular to them both, also known as a normal of a plane.
Returns squared distance between this vector to given vector. This is faster than Distance, and can be used for things like comparing distances, as long as only squared values are used.
Returns true if value on every axis is less than tolerance away from zero
Performs linear interpolation between this and given vectors.
Performs linear interpolation between this and given vectors, with separate fraction for each vector component.
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.
Rotate this vector around given point by given rotation and return the result as a new vector.
See Transform.RotateAround for similar method that also transforms rotation.
Snap to grid along any of the 3 axes.
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.
Write this vector3 to a System.IO.BinaryWriter.
Formats the Vector into a string "x,y,z"
Clientside, returns position of this 3D vector on local clients' screen in 2D coordinates based on the Sandbox.Camera.
Same as SandboxGameExtensions.ToScreen, but return value is in absolute coordinates.