# Vector3 Structure (Microsoft.Xna.Framework)

Describes a 3D-vector.

- C#
- VB
- F#

[TypeConverterAttribute(Microsoft.Xna.Framework.Design.Vector3TypeConverter)] [DataContractAttribute] [DebuggerDisplayAttribute("{DebugDisplayString,nq}")] [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = -1, Size = -1)] public struct Vector3 : IEquatable<Vector3>

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

The Vector3 type exposes the following members.

Platforms | Name | Description | |
---|---|---|---|

Vector3(float, float, float) | Constructs a 3d vector with X, Y and Z from three values. | ||

Vector3(float) | Constructs a 3d vector with X, Y and Z set to the same value. | ||

Vector3(Vector2, float) | Constructs a 3d vector with X, Y from Vector2 and Z from a scalar. |

Platforms | Name | Description | |
---|---|---|---|

Backward | Returns a Vector3 with components 0, 0, 1. |
||

Down | Returns a Vector3 with components 0, -1, 0. |
||

Forward | Returns a Vector3 with components 0, 0, -1. |
||

Left | Returns a Vector3 with components -1, 0, 0. |
||

One | Returns a Vector3 with components 1, 1, 1. |
||

Right | Returns a Vector3 with components 1, 0, 0. |
||

UnitX | Returns a Vector3 with components 1, 0, 0. |
||

UnitY | Returns a Vector3 with components 0, 1, 0. |
||

UnitZ | Returns a Vector3 with components 0, 0, 1. |
||

Up | Returns a Vector3 with components 0, 1, 0. |
||

Zero | Returns a Vector3 with components 0, 0, 0. |

Platforms | Name | Description | |
---|---|---|---|

Add(Vector3, Vector3) | Performs vector addition on value1 and value2. | ||

Add(Vector3, Vector3, out Vector3) | Performs vector addition on value1 and value2, storing the result of the addition in result. | ||

Barycentric(Vector3, Vector3, Vector3, float, float) | Creates a new Vector3 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 3d-triangle. |
||

Barycentric(Vector3, Vector3, Vector3, float, float, out Vector3) | Creates a new Vector3 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 3d-triangle. |
||

CatmullRom(Vector3, Vector3, Vector3, Vector3, float) | Creates a new Vector3 that contains CatmullRom interpolation of the specified vectors. |
||

CatmullRom(Vector3, Vector3, Vector3, Vector3, float, out Vector3) | Creates a new Vector3 that contains CatmullRom interpolation of the specified vectors. |
||

Ceiling() | Round the members of this Vector3 towards positive infinity. |
||

Ceiling(Vector3) | Creates a new Vector3 that contains members from another vector rounded towards positive infinity. |
||

Ceiling(Vector3, out Vector3) | Creates a new Vector3 that contains members from another vector rounded towards positive infinity. |
||

Clamp(Vector3, Vector3, Vector3) | Clamps the specified value within a range. | ||

Clamp(Vector3, Vector3, Vector3, out Vector3) | Clamps the specified value within a range. | ||

Cross(Vector3, Vector3, out Vector3) | Computes the cross product of two vectors. | ||

Cross(Vector3, Vector3) | Computes the cross product of two vectors. | ||

Deconstruct | Deconstruction method for Vector3. |
||

Distance(Vector3, Vector3) | Returns the distance between two vectors. | ||

Distance(Vector3, Vector3, out Single) | Returns the distance between two vectors. | ||

DistanceSquared(Vector3, Vector3) | Returns the squared distance between two vectors. | ||

DistanceSquared(Vector3, Vector3, out Single) | Returns the squared distance between two vectors. | ||

Divide(Vector3, Vector3) | Divides the components of a Vector3 by the components of another Vector3. |
||

Divide(Vector3, float) | Divides the components of a Vector3 by a scalar. |
||

Divide(Vector3, float, out Vector3) | Divides the components of a Vector3 by a scalar. |
||

Divide(Vector3, Vector3, out Vector3) | Divides the components of a Vector3 by the components of another Vector3. |
||

Dot(Vector3, Vector3) | Returns a dot product of two vectors. | ||

Dot(Vector3, Vector3, out Single) | Returns a dot product of two vectors. | ||

Equals(object) | Compares whether current instance is equal to specified System.Object. (Overrides ValueType.Equals().) | ||

Equals(Vector3) | Compares whether current instance is equal to specified Vector3. (Implements IEquatable<T>.Equals().) |
||

Floor() | Round the members of this Vector3 towards negative infinity. |
||

Floor(Vector3) | Creates a new Vector3 that contains members from another vector rounded towards negative infinity. |
||

Floor(Vector3, out Vector3) | Creates a new Vector3 that contains members from another vector rounded towards negative infinity. |
||

GetHashCode | Gets the hash code of this Vector3. (Overrides ValueType.GetHashCode().) |
||

Hermite(Vector3, Vector3, Vector3, Vector3, float, out Vector3) | Creates a new Vector3 that contains hermite spline interpolation. |
||

Hermite(Vector3, Vector3, Vector3, Vector3, float) | Creates a new Vector3 that contains hermite spline interpolation. |
||

Length | Returns the length of this Vector3. |
||

LengthSquared | Returns the squared length of this Vector3. |
||

Lerp(Vector3, Vector3, float) | Creates a new Vector3 that contains linear interpolation of the specified vectors. |
||

Lerp(Vector3, Vector3, float, out Vector3) | Creates a new Vector3 that contains linear interpolation of the specified vectors. |
||

LerpPrecise(Vector3, Vector3, float, out Vector3) | Creates a new Vector3 that contains linear interpolation of the specified vectors.
Uses LerpPrecise(float, float, float) on MathHelper for the interpolation.
Less efficient but more precise compared to Lerp(Vector3, Vector3, float, out Vector3).
See remarks section of LerpPrecise(float, float, float) on MathHelper for more info. |
||

LerpPrecise(Vector3, Vector3, float) | Creates a new Vector3 that contains linear interpolation of the specified vectors.
Uses LerpPrecise(float, float, float) on MathHelper for the interpolation.
Less efficient but more precise compared to Lerp(Vector3, Vector3, float).
See remarks section of LerpPrecise(float, float, float) on MathHelper for more info. |
||

Max(Vector3, Vector3, out Vector3) | Creates a new Vector3 that contains a maximal values from the two vectors. |
||

Max(Vector3, Vector3) | Creates a new Vector3 that contains a maximal values from the two vectors. |
||

Min(Vector3, Vector3) | Creates a new Vector3 that contains a minimal values from the two vectors. |
||

Min(Vector3, Vector3, out Vector3) | Creates a new Vector3 that contains a minimal values from the two vectors. |
||

Multiply(Vector3, Vector3) | Creates a new Vector3 that contains a multiplication of two vectors. |
||

Multiply(Vector3, float, out Vector3) | Creates a new Vector3 that contains a multiplication of Vector3 and a scalar. |
||

Multiply(Vector3, Vector3, out Vector3) | Creates a new Vector3 that contains a multiplication of two vectors. |
||

Multiply(Vector3, float) | Creates a new Vector3 that contains a multiplication of Vector3 and a scalar. |
||

Negate(Vector3, out Vector3) | Creates a new Vector3 that contains the specified vector inversion. |
||

Negate(Vector3) | Creates a new Vector3 that contains the specified vector inversion. |
||

Normalize() | Turns this Vector3 to a unit vector with the same direction. |
||

Normalize(Vector3) | Creates a new Vector3 that contains a normalized values from another vector. |
||

Normalize(Vector3, out Vector3) | Creates a new Vector3 that contains a normalized values from another vector. |
||

Reflect(Vector3, Vector3) | Creates a new Vector3 that contains reflect vector of the given vector and normal. |
||

Reflect(Vector3, Vector3, out Vector3) | Creates a new Vector3 that contains reflect vector of the given vector and normal. |
||

Round() | Round the members of this Vector3 towards the nearest integer value. |
||

Round(Vector3) | Creates a new Vector3 that contains members from another vector rounded to the nearest integer value. |
||

Round(Vector3, out Vector3) | Creates a new Vector3 that contains members from another vector rounded to the nearest integer value. |
||

SmoothStep(Vector3, Vector3, float) | Creates a new Vector3 that contains cubic interpolation of the specified vectors. |
||

SmoothStep(Vector3, Vector3, float, out Vector3) | Creates a new Vector3 that contains cubic interpolation of the specified vectors. |
||

Subtract(Vector3, Vector3, out Vector3) | Creates a new Vector3 that contains subtraction of on Vector3 from a another. |
||

Subtract(Vector3, Vector3) | Creates a new Vector3 that contains subtraction of on Vector3 from a another. |
||

ToString | Returns a System.String representation of this Vector3 in the format:
{X:[X] Y:[Y] Z:[Z]} (Overrides ValueType.ToString().) |
||

Transform(Vector3[], Quaternion, Vector3[]) | Apply transformation on all vectors within array of Vector3 by the specified Quaternion and places the results in an another array. |
||

Transform(Vector3[], Matrix, Vector3[]) | Apply transformation on all vectors within array of Vector3 by the specified Matrix and places the results in an another array. |
||

Transform(Vector3[], int, Quaternion, Vector3[], int, int) | Apply transformation on vectors within array of Vector3 by the specified Quaternion and places the results in an another array. |
||

Transform(Vector3[], int, Matrix, Vector3[], int, int) | Apply transformation on vectors within array of Vector3 by the specified Matrix and places the results in an another array. |
||

Transform(Vector3, Quaternion, out Vector3) | Creates a new Vector3 that contains a transformation of 3d-vector by the specified Quaternion, representing the rotation. |
||

Transform(Vector3, Quaternion) | Creates a new Vector3 that contains a transformation of 3d-vector by the specified Quaternion, representing the rotation. |
||

Transform(Vector3, Matrix, out Vector3) | Creates a new Vector3 that contains a transformation of 3d-vector by the specified Matrix. |
||

Transform(Vector3, Matrix) | Creates a new Vector3 that contains a transformation of 3d-vector by the specified Matrix. |
||

TransformNormal(Vector3, Matrix, out Vector3) | Creates a new Vector3 that contains a transformation of the specified normal by the specified Matrix. |
||

TransformNormal(Vector3[], Matrix, Vector3[]) | Apply transformation on all normals within array of Vector3 by the specified Matrix and places the results in an another array. |
||

TransformNormal(Vector3, Matrix) | Creates a new Vector3 that contains a transformation of the specified normal by the specified Matrix. |
||

TransformNormal(Vector3[], int, Matrix, Vector3[], int, int) | Apply transformation on normals within array of Vector3 by the specified Matrix and places the results in an another array. |

Platforms | Name | Description | |
---|---|---|---|

Equality | Compares whether two Vector3 instances are equal. |
||

Inequality | Compares whether two Vector3 instances are not equal. |
||

Addition | Adds two vectors. | ||

UnaryNegation | Inverts values in the specified Vector3. |
||

Subtraction | Subtracts a Vector3 from a Vector3. |
||

Multiply(Vector3, Vector3) | Multiplies the components of two vectors by each other. | ||

Multiply(Vector3, float) | Multiplies the components of vector by a scalar. | ||

Multiply(float, Vector3) | Multiplies the components of vector by a scalar. | ||

Division(Vector3, Vector3) | Divides the components of a Vector3 by the components of another Vector3. |
||

Division(Vector3, float) | Divides the components of a Vector3 by a scalar. |

Supported in:

Windows DirectX Desktop

Linux Desktop

Windows OpenGL Desktop

Web

Windows DirectX Desktop

Linux Desktop

Windows OpenGL Desktop

Web