# Vector4

A 4-dimensional vector/point.

- Kind: struct
- Assembly: `Sandbox.System`
- Modifiers: sealed

## Constructors

- [`Vector4`](/api/Vector4/.ctor): Initializes a vector4 with given components.

## Fields

- [`One`](/api/Vector4/One): A 4D vector with all components set to 1.
- [`Zero`](/api/Vector4/Zero): A 4D vector with all components set to 0.

## Properties

- [`IsInfinity`](/api/Vector4/IsInfinity): Returns true if x, y, z or w are infinity
- [`IsNaN`](/api/Vector4/IsNaN): Returns true if x, y, z or w are NaN
- [`IsNearZeroLength`](/api/Vector4/IsNearZeroLength): Whether length of this vector is nearly zero.
- [`Item`](/api/Vector4/Item)
- [`Length`](/api/Vector4/Length): The length (or magnitude) of the vector (Distance from 0,0,0).
- [`LengthSquared`](/api/Vector4/LengthSquared): Squared length of the vector. This is faster than [Vector4.Length](/api/Vector4/Length), and can be used for things like comparing distances, as long as only squared values are used.
- [`w`](/api/Vector4/w): The W component of this Vector.
- [`x`](/api/Vector4/x): The X component of this Vector.
- [`y`](/api/Vector4/y): The Y component of this Vector.
- [`z`](/api/Vector4/z): The Z component of this Vector.

## Methods

- [`AlmostEqual`](/api/Vector4/AlmostEqual): Returns true if we're nearly equal to the passed vector.
- [`Clamp`](/api/Vector4/Clamp): Returns a vector each axis of which is clamped to between the 2 given vectors.
- [`ComponentMax`](/api/Vector4/ComponentMax): Returns a vector that has the maximum values on each axis between this vector and given vector.
- [`ComponentMin`](/api/Vector4/ComponentMin): Returns a vector that has the minimum values on each axis between this vector and given vector.
- [`Distance`](/api/Vector4/Distance): Returns distance between this vector to given vector.
- [`DistanceBetween`](/api/Vector4/DistanceBetween)
- [`DistanceBetweenSquared`](/api/Vector4/DistanceBetweenSquared): Returns squared distance between the 2 given vectors. This is faster than [DistanceBetween](/api/Vector4/DistanceBetween), and can be used for things like comparing distances, as long as only squared values are used.
- [`DistanceSquared`](/api/Vector4/DistanceSquared): Returns squared distance between this vector to given vector. This is faster than [Distance](/api/Vector4/Distance), and can be used for things like comparing distances, as long as only squared values are used.
- [`Dot`](/api/Vector4/Dot): Returns the scalar/dot product of the 2 given vectors
- [`IsNearlyZero`](/api/Vector4/IsNearlyZero): Returns true if value on every axis is less than tolerance away from zero
- [`Lerp`](/api/Vector4/Lerp): Performs linear interpolation between 2 given vectors.
- [`LerpTo`](/api/Vector4/LerpTo): Performs linear interpolation between this and given vectors.
- [`Max`](/api/Vector4/Max): Returns a vector that has the maximum values on each axis between the 2 given vectors.
- [`Min`](/api/Vector4/Min): Returns a vector that has the minimum values on each axis between the 2 given vectors.
- [`Parse`](/api/Vector4/Parse): Given a string, try to convert this into a vector4. The format is "x,y,z,w".
- [`SnapToGrid`](/api/Vector4/SnapToGrid): Snap to grid along any of the 4 axes.
- [`Sort`](/api/Vector4/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, z and w values.
- [`TryParse`](/api/Vector4/TryParse)
- [`WithW`](/api/Vector4/WithW): Returns this vector with given W component.
- [`WithX`](/api/Vector4/WithX): Returns this vector with given X component.
- [`WithY`](/api/Vector4/WithY): Returns this vector with given Y component.
- [`WithZ`](/api/Vector4/WithZ): Returns this vector with given Z component.
