S&box Wiki




static Vector3 Down
static Vector3 Left
static Vector3 One
static Vector3 OneX
static Vector3 OneY
static Vector3 OneZ
static Vector3 Right
static Vector3 Up
static Vector3 Zero


Angles EulerAngles { get; set; }
The euler angle of this vector
bool IsNaN { get; }
Returns true if x, y or z are NaN
bool IsNearZeroLength { get; }
float Length { get; }
float LengthSquared { get; }
Vector3 Normal { get; }
static Vector3 Random { get; }
bool SafeToNormalize { get; }
float x { get; set; }
float y { get; set; }
float z { get; set; }


float Angle( Vector3 v2 )
Return the distance between the two direction vectors in radians
Vector3 Approach( float length, float amount )
Vector3 ClampLength( float maxLength )
float Distance( Vector3 target )
Return the magnitude of a vector. Equivalent of doing (targetVector - originVector).Length Please note that this is calculated using a square root and a square root calculation is quite expensive. If you just want to compare 2 distances consider doing (targetVector - originVector).LengthSquared > (distance * distance)
static float DistanceBetween( Vector3 a, Vector3 b )
float Dot( Vector3 b )
Computes the scalar dot product of two three-dimensional vectors.
static float GetAngle( Vector3 v1, Vector3 v2 )
Return the distance between the two direction vectors in radians
bool IsNearlyEqual( Vector3 v, float delta = 0.0001 )
Returns true if we're nearly equal to the passed vector.
bool IsNearlyZero( float tolerance = 1E-45 )
Return true if less than tolerance away from zero
static Vector3 Lerp( Vector3 a, Vector3 b, float t, bool clamp = True )
Vector3 LerpTo( Vector3 target, float t )
static Vector3 Max( Vector3 a, Vector3 b )
static Vector3 Min( Vector3 a, Vector3 b )
static Vector3 Parse( string str )
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 seperators ( ' ', ',', ';', '\n', '\r' ). It also trims surrounding characters ('[', ']', ' ', '\n', '\r', '\t', '"').
Vector3 Read( System.IO.BinaryReader reader )
static Vector3 Reflect( Vector3 direction, Vector3 normal )
Vector3 SnapToGrid( float gridSize, bool sx = True, bool sy = True, bool sz = True )
Snap To Grid along all 3 axes
static void Sort( Vector3 min, Vector3 max )
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.
Vector3 SubtractDirection( Vector3 direction )
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 sutract by scaling the direction. Ie, passing in a direction with a length of 0.5 will remove half the direction.
static Angles VectorAngle( Vector3 vec )
Converts a vector to an angle
static Vector3 VectorPlaneProject( Vector3 v, Vector3 planeNormal )
Vector3 WithX( float x )
Vector3 WithY( float y )
Vector3 WithZ( float z )
void Write( System.IO.BinaryWriter writer )

Special Pages



Render Time: 15ms

DB GetPage 4
Generate Html 0
SaveChanges (1) 8
Render Body 0
Render Sidebar 0