Search Results for

    Show / Hide Table of Contents

    Class Vector3

    Represents a three dimensional mathematical vector.

    Inheritance
    System.Object
    Vector3
    Implements
    System.IEquatable<Vector3>
    System.IFormattable
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class Vector3 : ValueType, IEquatable<Vector3>, IFormattable

    Constructors

    Vector3(Vector2, Single)

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(Vector2 value, float z)
    Parameters
    Vector2 value

    A vector containing the values with which to initialize the X and Y components.

    System.Single z

    Initial value for the Z component of the vector.

    Vector3(Vector4)

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(Vector4 value)
    Parameters
    Vector4 value

    A vector containing the values with which to initialize the X, Y and Z components.

    Vector3(Double)

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(double value)
    Parameters
    System.Double value

    The value that will be assigned to all components.

    Vector3(Double, Double, Double)

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(double x, double y, double z)
    Parameters
    System.Double x

    Initial value for the X component of the vector.

    System.Double y

    Initial value for the Y component of the vector.

    System.Double z

    Initial value for the Z component of the vector.

    Vector3(Single)

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(float value)
    Parameters
    System.Single value

    The value that will be assigned to all components.

    Vector3(Single, Single, Single)

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(float x, float y, float z)
    Parameters
    System.Single x

    Initial value for the X component of the vector.

    System.Single y

    Initial value for the Y component of the vector.

    System.Single z

    Initial value for the Z component of the vector.

    Vector3(Single[])

    Initializes a new instance of the Vector3 struct.

    Declaration
    public Vector3(float[] values)
    Parameters
    System.Single[] values

    The values to assign to the X, Y, and Z components of the vector. This must be an array with three elements.

    Exceptions
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than three elements.

    Fields

    Backward

    A unit Vector3 designating backward in a left-handed coordinate system (0, 0, -1).

    Declaration
    public static readonly Vector3 Backward
    Field Value
    Vector3

    Down

    A unit Vector3 designating down (0, -1, 0).

    Declaration
    public static readonly Vector3 Down
    Field Value
    Vector3

    Forward

    A unit Vector3 designating forward in a left-handed coordinate system (0, 0, 1).

    Declaration
    public static readonly Vector3 Forward
    Field Value
    Vector3

    Half

    A Vector3 with all of its components set to half.

    Declaration
    public static readonly Vector3 Half
    Field Value
    Vector3

    Left

    A unit Vector3 designating left (-1, 0, 0).

    Declaration
    public static readonly Vector3 Left
    Field Value
    Vector3

    Maximum

    A Vector3 with all components equal to System.Double.MaxValue (or System.Single.MaxValue if using 32-bit precision).

    Declaration
    public static readonly Vector3 Maximum
    Field Value
    Vector3

    Minimum

    A Vector3 with all components equal to System.Double.MinValue (or System.Single.MinValue if using 32-bit precision).

    Declaration
    public static readonly Vector3 Minimum
    Field Value
    Vector3

    One

    A Vector3 with all of its components set to one.

    Declaration
    public static readonly Vector3 One
    Field Value
    Vector3

    Right

    A unit Vector3 designating right (1, 0, 0).

    Declaration
    public static readonly Vector3 Right
    Field Value
    Vector3

    SizeInBytes

    The size of the Vector3 type, in bytes.

    Declaration
    public static readonly int SizeInBytes
    Field Value
    System.Int32

    UnitX

    The X unit Vector3 (1, 0, 0).

    Declaration
    public static readonly Vector3 UnitX
    Field Value
    Vector3

    UnitY

    The Y unit Vector3 (0, 1, 0).

    Declaration
    public static readonly Vector3 UnitY
    Field Value
    Vector3

    UnitZ

    The Z unit Vector3 (0, 0, 1).

    Declaration
    public static readonly Vector3 UnitZ
    Field Value
    Vector3

    Up

    A unit Vector3 designating up (0, 1, 0).

    Declaration
    public static readonly Vector3 Up
    Field Value
    Vector3

    X

    The X component.

    Declaration
    public float X
    Field Value
    System.Single

    Y

    The Y component.

    Declaration
    public float Y
    Field Value
    System.Single

    Z

    The Z component.

    Declaration
    public float Z
    Field Value
    System.Single

    Zero

    A Vector3 with all of its components set to zero.

    Declaration
    public static readonly Vector3 Zero
    Field Value
    Vector3

    Properties

    Absolute

    Gets a vector with values being absolute values of that vector.

    Declaration
    public Vector3 Absolute { get; }
    Property Value
    Vector3

    AvgValue

    Gets an arithmetic average value of all vector components.

    Declaration
    public float AvgValue { get; }
    Property Value
    System.Single

    IsNormalized

    Gets a value indicting whether this instance is normalized.

    Declaration
    public bool IsNormalized { get; }
    Property Value
    System.Boolean

    IsOne

    Gets a value indicting whether this vector is one

    Declaration
    public bool IsOne { get; }
    Property Value
    System.Boolean

    IsZero

    Gets a value indicting whether this vector is zero

    Declaration
    public bool IsZero { get; }
    Property Value
    System.Boolean

    Item[Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    System.Int32 index

    The index of the component to access. Use 0 for the X component, 1 for the Y component, and 2 for the Z component.

    Property Value
    System.Single

    The value of the X, Y, or Z component, depending on the index.

    Exceptions
    System.ArgumentOutOfRangeException

    Thrown when the index is out of the range [0, 2].

    Length

    Calculates the length of the vector.

    Declaration
    public float Length { get; }
    Property Value
    System.Single

    The length of the vector.

    Remarks

    LengthSquared may be preferred when only the relative length is needed and speed is of the essence.

    LengthSquared

    Calculates the squared length of the vector.

    Declaration
    public float LengthSquared { get; }
    Property Value
    System.Single

    The squared length of the vector.

    Remarks

    This method may be preferred to Length when only a relative length is needed and speed is of the essence.

    MaxValue

    Gets a maximum component value

    Declaration
    public float MaxValue { get; }
    Property Value
    System.Single

    MinValue

    Gets a minimum component value

    Declaration
    public float MinValue { get; }
    Property Value
    System.Single

    Negative

    Gets a vector with values being opposite to values of that vector.

    Declaration
    public Vector3 Negative { get; }
    Property Value
    Vector3

    Normalized

    Gets the normalized vector. Returned vector has length equal 1.

    Declaration
    public Vector3 Normalized { get; }
    Property Value
    Vector3

    ValuesSum

    Gets a sum of the component values.

    Declaration
    public float ValuesSum { get; }
    Property Value
    System.Single

    Methods

    Abs(Vector3)

    Returns the absolute value of a vector.

    Declaration
    public static Vector3 Abs(Vector3 v)
    Parameters
    Vector3 v

    The value.

    Returns
    Vector3

    A vector which components are less or equal to 0.

    Add(Vector3, Vector3)

    Adds two vectors.

    Declaration
    public static Vector3 Add(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first vector to add.

    Vector3 right

    The second vector to add.

    Returns
    Vector3

    The sum of the two vectors.

    Add(Vector3, Single)

    Performs a component-wise addition.

    Declaration
    public static Vector3 Add(Vector3 left, float right)
    Parameters
    Vector3 left

    The input vector

    System.Single right

    The scalar value to be added to elements

    Returns
    Vector3

    The vector with added scalar for each element.

    Add(ref Vector3, ref Vector3, out Vector3)

    Adds two vectors.

    Declaration
    public static void Add(ref Vector3 left, ref Vector3 right, out Vector3 result)
    Parameters
    Vector3 left

    The first vector to add.

    Vector3 right

    The second vector to add.

    Vector3 result

    When the method completes, contains the sum of the two vectors.

    Add(ref Vector3, ref Single, out Vector3)

    Performs a component-wise addition.

    Declaration
    public static void Add(ref Vector3 left, ref float right, out Vector3 result)
    Parameters
    Vector3 left

    The input vector

    System.Single right

    The scalar value to be added to elements

    Vector3 result

    The vector with added scalar for each element.

    Angle(Vector3, Vector3)

    Calculates the angle (in degrees) between from and to vectors. This is always the smallest value.

    Declaration
    public static float Angle(Vector3 from, Vector3 to)
    Parameters
    Vector3 from

    The first vector.

    Vector3 to

    The second vector.

    Returns
    System.Single

    The angle (in degrees).

    Barycentric(Vector3, Vector3, Vector3, Single, Single)

    Returns a Vector3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.

    Declaration
    public static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2)
    Parameters
    Vector3 value1

    A Vector3 containing the 3D Cartesian coordinates of vertex 1 of the triangle.

    Vector3 value2

    A Vector3 containing the 3D Cartesian coordinates of vertex 2 of the triangle.

    Vector3 value3

    A Vector3 containing the 3D Cartesian coordinates of vertex 3 of the triangle.

    System.Single amount1

    Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

    System.Single amount2

    Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

    Returns
    Vector3

    A new Vector3 containing the 3D Cartesian coordinates of the specified point.

    Barycentric(ref Vector3, ref Vector3, ref Vector3, Single, Single, out Vector3)

    Returns a Vector3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.

    Declaration
    public static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result)
    Parameters
    Vector3 value1

    A Vector3 containing the 3D Cartesian coordinates of vertex 1 of the triangle.

    Vector3 value2

    A Vector3 containing the 3D Cartesian coordinates of vertex 2 of the triangle.

    Vector3 value3

    A Vector3 containing the 3D Cartesian coordinates of vertex 3 of the triangle.

    System.Single amount1

    Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

    System.Single amount2

    Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

    Vector3 result

    When the method completes, contains the 3D Cartesian coordinates of the specified point.

    CatmullRom(Vector3, Vector3, Vector3, Vector3, Single)

    Performs a Catmull-Rom interpolation using the specified positions.

    Declaration
    public static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount)
    Parameters
    Vector3 value1

    The first position in the interpolation.

    Vector3 value2

    The second position in the interpolation.

    Vector3 value3

    The third position in the interpolation.

    Vector3 value4

    The fourth position in the interpolation.

    System.Single amount

    Weighting factor.

    Returns
    Vector3

    A vector that is the result of the Catmull-Rom interpolation.

    CatmullRom(ref Vector3, ref Vector3, ref Vector3, ref Vector3, Single, out Vector3)

    Performs a Catmull-Rom interpolation using the specified positions.

    Declaration
    public static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result)
    Parameters
    Vector3 value1

    The first position in the interpolation.

    Vector3 value2

    The second position in the interpolation.

    Vector3 value3

    The third position in the interpolation.

    Vector3 value4

    The fourth position in the interpolation.

    System.Single amount

    Weighting factor.

    Vector3 result

    When the method completes, contains the result of the Catmull-Rom interpolation.

    Clamp(Vector3, Vector3, Vector3)

    Restricts a value to be within a specified range.

    Declaration
    public static Vector3 Clamp(Vector3 value, Vector3 min, Vector3 max)
    Parameters
    Vector3 value

    The value to clamp.

    Vector3 min

    The minimum value.

    Vector3 max

    The maximum value.

    Returns
    Vector3

    The clamped value.

    Clamp(ref Vector3, ref Vector3, ref Vector3, out Vector3)

    Restricts a value to be within a specified range.

    Declaration
    public static void Clamp(ref Vector3 value, ref Vector3 min, ref Vector3 max, out Vector3 result)
    Parameters
    Vector3 value

    The value to clamp.

    Vector3 min

    The minimum value.

    Vector3 max

    The maximum value.

    Vector3 result

    When the method completes, contains the clamped value.

    ClampLength(Vector3, Single)

    Makes sure that Length of the output vector is always below max and above 0.

    Declaration
    public static Vector3 ClampLength(Vector3 vector, float max)
    Parameters
    Vector3 vector

    Input Vector.

    System.Single max

    Max Length

    Returns
    Vector3

    ClampLength(Vector3, Single, Single)

    Makes sure that Length of the output vector is always below max and above min.

    Declaration
    public static Vector3 ClampLength(Vector3 vector, float min, float max)
    Parameters
    Vector3 vector

    Input Vector.

    System.Single min

    Min Length

    System.Single max

    Max Length

    Returns
    Vector3

    ClampLength(Vector3, Single, Single, out Vector3)

    Makes sure that Length of the output vector is always below max and above min.

    Declaration
    public static void ClampLength(Vector3 vector, float min, float max, out Vector3 result)
    Parameters
    Vector3 vector

    Input Vector.

    System.Single min

    Min Length

    System.Single max

    Max Length

    Vector3 result

    The result vector.

    Cross(Vector3, Vector3)

    Calculates the cross product of two vectors.

    Declaration
    public static Vector3 Cross(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    First source vector.

    Vector3 right

    Second source vector.

    Returns
    Vector3

    The cross product of the two vectors.

    Cross(ref Vector3, ref Vector3, out Vector3)

    Calculates the cross product of two vectors.

    Declaration
    public static void Cross(ref Vector3 left, ref Vector3 right, out Vector3 result)
    Parameters
    Vector3 left

    First source vector.

    Vector3 right

    Second source vector.

    Vector3 result

    When the method completes, contains he cross product of the two vectors.

    Distance(Vector3, Vector3)

    Calculates the distance between two vectors.

    Declaration
    public static float Distance(Vector3 value1, Vector3 value2)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    Returns
    System.Single

    The distance between the two vectors.

    Remarks

    DistanceSquared(Vector3, Vector3) may be preferred when only the relative distance is needed and speed is of the essence.

    Distance(ref Vector3, ref Vector3)

    Calculates the distance between two vectors.

    Declaration
    public static float Distance(ref Vector3 value1, ref Vector3 value2)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    Returns
    System.Single

    The distance between the two vectors.

    Remarks

    DistanceSquared(ref Vector3, ref Vector3, out Single) may be preferred when only the relative distance is needed and speed is of the essence.

    Distance(ref Vector3, ref Vector3, out Single)

    Calculates the distance between two vectors.

    Declaration
    public static void Distance(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    System.Single result

    When the method completes, contains the distance between the two vectors.

    Remarks

    DistanceSquared(ref Vector3, ref Vector3, out Single) may be preferred when only the relative distance is needed and speed is of the essence.

    DistanceSquared(Vector3, Vector3)

    Calculates the squared distance between two vectors.

    Declaration
    public static float DistanceSquared(Vector3 value1, Vector3 value2)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    Returns
    System.Single

    The squared distance between the two vectors.

    DistanceSquared(ref Vector3, ref Vector3)

    Calculates the squared distance between two vectors.

    Declaration
    public static float DistanceSquared(ref Vector3 value1, ref Vector3 value2)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    Returns
    System.Single

    The squared distance between the two vectors.

    DistanceSquared(ref Vector3, ref Vector3, out Single)

    Calculates the squared distance between two vectors.

    Declaration
    public static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    System.Single result

    When the method completes, contains the squared distance between the two vectors.

    DistanceXY(ref Vector3, ref Vector3, out Single)

    Calculates the distance between two vectors on the XY plane (ignoring Z).

    Declaration
    public static void DistanceXY(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    System.Single result

    When the method completes, contains the distance between the two vectors in the XY plane.

    DistanceXYSquared(ref Vector3, ref Vector3, out Single)

    Calculates the squared distance between two vectors on the XY plane (ignoring Z).

    Declaration
    public static void DistanceXYSquared(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector

    System.Single result

    When the method completes, contains the squared distance between the two vectors in the XY plane.

    DistanceXZ(ref Vector3, ref Vector3, out Single)

    Calculates the distance between two vectors on the XZ plane (ignoring Y).

    Declaration
    public static void DistanceXZ(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    System.Single result

    When the method completes, contains the distance between the two vectors in the XY plane.

    DistanceXZSquared(ref Vector3, ref Vector3, out Single)

    Calculates the squared distance between two vectors on the XZ plane (ignoring Y).

    Declaration
    public static void DistanceXZSquared(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector

    System.Single result

    When the method completes, contains the squared distance between the two vectors in the XY plane.

    DistanceYZ(ref Vector3, ref Vector3, out Single)

    Calculates the distance between two vectors on the YZ plane (ignoring X).

    Declaration
    public static void DistanceYZ(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector.

    System.Single result

    When the method completes, contains the distance between the two vectors in the YZ plane.

    DistanceYZSquared(ref Vector3, ref Vector3, out Single)

    Calculates the squared distance between two vectors on the YZ plane (ignoring X).

    Declaration
    public static void DistanceYZSquared(ref Vector3 value1, ref Vector3 value2, out float result)
    Parameters
    Vector3 value1

    The first vector.

    Vector3 value2

    The second vector

    System.Single result

    When the method completes, contains the squared distance between the two vectors in the YZ plane.

    Divide(Vector3, Vector3)

    Divides a vector by the given value.

    Declaration
    public static Vector3 Divide(Vector3 value, Vector3 scale)
    Parameters
    Vector3 value

    The vector to scale.

    Vector3 scale

    The amount by which to scale the vector (per component).

    Returns
    Vector3

    The divided vector.

    Divide(Vector3, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector3 Divide(Vector3 value, float scale)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The scaled vector.

    Divide(ref Vector3, ref Vector3, out Vector3)

    Divides a vector by the given value.

    Declaration
    public static void Divide(ref Vector3 value, ref Vector3 scale, out Vector3 result)
    Parameters
    Vector3 value

    The vector to scale.

    Vector3 scale

    The amount by which to scale the vector (per component).

    Vector3 result

    When the method completes, contains the divided vector.

    Divide(ref Vector3, Single, out Vector3)

    Scales a vector by the given value.

    Declaration
    public static void Divide(ref Vector3 value, float scale, out Vector3 result)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Vector3 result

    When the method completes, contains the scaled vector.

    Divide(Single, Vector3)

    Scales a vector by the given value.

    Declaration
    public static Vector3 Divide(float scale, Vector3 value)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector3 value

    The vector to scale.

    Returns
    Vector3

    The scaled vector.

    Divide(Single, ref Vector3, out Vector3)

    Scales a vector by the given value.

    Declaration
    public static void Divide(float scale, ref Vector3 value, out Vector3 result)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector3 value

    The vector to scale.

    Vector3 result

    When the method completes, contains the scaled vector.

    Dot(Vector3, Vector3)

    Calculates the dot product of two vectors.

    Declaration
    public static float Dot(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    First source vector.

    Vector3 right

    Second source vector.

    Returns
    System.Single

    The dot product of the two vectors.

    Dot(ref Vector3, ref Vector3)

    Calculates the dot product of two vectors.

    Declaration
    public static float Dot(ref Vector3 left, ref Vector3 right)
    Parameters
    Vector3 left

    First source vector.

    Vector3 right

    Second source vector.

    Returns
    System.Single

    The dot product of the two vectors.

    Dot(ref Vector3, ref Vector3, out Single)

    Calculates the dot product of two vectors.

    Declaration
    public static void Dot(ref Vector3 left, ref Vector3 right, out float result)
    Parameters
    Vector3 left

    First source vector.

    Vector3 right

    Second source vector.

    System.Single result

    When the method completes, contains the dot product of the two vectors.

    Equals(Vector3)

    Determines whether the specified Vector3 is equal to this instance.

    Declaration
    public bool Equals(Vector3 other)
    Parameters
    Vector3 other

    The Vector3 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Vector3 is equal to this instance; otherwise, false.

    Equals(ref Vector3)

    Determines whether the specified Vector3 is equal to this instance.

    Declaration
    public bool Equals(ref Vector3 other)
    Parameters
    Vector3 other

    The Vector3 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Vector3 is equal to this instance; otherwise, false.

    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    Declaration
    public override bool Equals(object value)
    Parameters
    System.Object value

    The System.Object to compare with this instance.

    Returns
    System.Boolean

    true if the specified System.Object is equal to this instance; otherwise, false.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    System.Int32

    Hermite(Vector3, Vector3, Vector3, Vector3, Single)

    Performs a Hermite spline interpolation.

    Declaration
    public static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount)
    Parameters
    Vector3 value1

    First source position vector.

    Vector3 tangent1

    First source tangent vector.

    Vector3 value2

    Second source position vector.

    Vector3 tangent2

    Second source tangent vector.

    System.Single amount

    Weighting factor.

    Returns
    Vector3

    The result of the Hermite spline interpolation.

    Hermite(ref Vector3, ref Vector3, ref Vector3, ref Vector3, Single, out Vector3)

    Performs a Hermite spline interpolation.

    Declaration
    public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)
    Parameters
    Vector3 value1

    First source position vector.

    Vector3 tangent1

    First source tangent vector.

    Vector3 value2

    Second source position vector.

    Vector3 tangent2

    Second source tangent vector.

    System.Single amount

    Weighting factor.

    Vector3 result

    When the method completes, contains the result of the Hermite spline interpolation.

    Lerp(Vector3, Vector3, Single)

    Performs a linear interpolation between two vectors.

    Declaration
    public static Vector3 Lerp(Vector3 start, Vector3 end, float amount)
    Parameters
    Vector3 start

    Start vector.

    Vector3 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Vector3

    The linear interpolation of the two vectors.

    Remarks

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

    Lerp(ref Vector3, ref Vector3, Single, out Vector3)

    Performs a linear interpolation between two vectors.

    Declaration
    public static void Lerp(ref Vector3 start, ref Vector3 end, float amount, out Vector3 result)
    Parameters
    Vector3 start

    Start vector.

    Vector3 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Vector3 result

    When the method completes, contains the linear interpolation of the two vectors.

    Remarks

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

    Max(Vector3, Vector3)

    Returns a vector containing the largest components of the specified vectors.

    Declaration
    public static Vector3 Max(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Vector3

    A vector containing the largest components of the source vectors.

    Max(ref Vector3, ref Vector3, out Vector3)

    Returns a vector containing the largest components of the specified vectors.

    Declaration
    public static void Max(ref Vector3 left, ref Vector3 right, out Vector3 result)
    Parameters
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Vector3 result

    When the method completes, contains an new vector composed of the largest components of the source vectors.

    Min(Vector3, Vector3)

    Returns a vector containing the smallest components of the specified vectors.

    Declaration
    public static Vector3 Min(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Vector3

    A vector containing the smallest components of the source vectors.

    Min(ref Vector3, ref Vector3, out Vector3)

    Returns a vector containing the smallest components of the specified vectors.

    Declaration
    public static void Min(ref Vector3 left, ref Vector3 right, out Vector3 result)
    Parameters
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Vector3 result

    When the method completes, contains an new vector composed of the smallest components of the source vectors.

    MoveTowards(Vector3, Vector3, Single)

    Moves a value current towards target.

    Declaration
    public static Vector3 MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta)
    Parameters
    Vector3 current

    The position to move from.

    Vector3 target

    The position to move towards.

    System.Single maxDistanceDelta

    The maximum distance that can be applied to the value.

    Returns
    Vector3

    The new position.

    Multiply(Vector3, Vector3)

    Multiply a vector with another by performing component-wise multiplication.

    Declaration
    public static Vector3 Multiply(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first vector to Multiply.

    Vector3 right

    The second vector to multiply.

    Returns
    Vector3

    The multiplied vector.

    Multiply(Vector3, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector3 Multiply(Vector3 value, float scale)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The scaled vector.

    Multiply(ref Vector3, ref Vector3, out Vector3)

    Multiply a vector with another by performing component-wise multiplication.

    Declaration
    public static void Multiply(ref Vector3 left, ref Vector3 right, out Vector3 result)
    Parameters
    Vector3 left

    The first vector to multiply.

    Vector3 right

    The second vector to multiply.

    Vector3 result

    When the method completes, contains the multiplied vector.

    Multiply(ref Vector3, Single, out Vector3)

    Scales a vector by the given value.

    Declaration
    public static void Multiply(ref Vector3 value, float scale, out Vector3 result)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Vector3 result

    When the method completes, contains the scaled vector.

    NearEqual(Vector3, Vector3, Single)

    Tests whether one vector is near another vector.

    Declaration
    public static bool NearEqual(Vector3 left, Vector3 right, float epsilon = 1E-06F)
    Parameters
    Vector3 left

    The left vector.

    Vector3 right

    The right vector.

    System.Single epsilon

    The epsilon.

    Returns
    System.Boolean

    true if left and right are near another, false otherwise

    NearEqual(ref Vector3, ref Vector3, Single)

    Tests whether one vector is near another vector.

    Declaration
    public static bool NearEqual(ref Vector3 left, ref Vector3 right, float epsilon = 1E-06F)
    Parameters
    Vector3 left

    The left vector.

    Vector3 right

    The right vector.

    System.Single epsilon

    The epsilon.

    Returns
    System.Boolean

    true if left and right are near another, false otherwise

    Negate(Vector3)

    Reverses the direction of a given vector.

    Declaration
    public static Vector3 Negate(Vector3 value)
    Parameters
    Vector3 value

    The vector to negate.

    Returns
    Vector3

    A vector facing in the opposite direction.

    Negate(ref Vector3, out Vector3)

    Reverses the direction of a given vector.

    Declaration
    public static void Negate(ref Vector3 value, out Vector3 result)
    Parameters
    Vector3 value

    The vector to negate.

    Vector3 result

    When the method completes, contains a vector facing in the opposite direction.

    Normalize()

    Converts the vector into a unit vector.

    Declaration
    public void Normalize()

    Normalize(Vector3)

    Converts the vector into a unit vector.

    Declaration
    public static Vector3 Normalize(Vector3 value)
    Parameters
    Vector3 value

    The vector to normalize.

    Returns
    Vector3

    The normalized vector.

    Normalize(ref Vector3, out Vector3)

    Converts the vector into a unit vector.

    Declaration
    public static void Normalize(ref Vector3 value, out Vector3 result)
    Parameters
    Vector3 value

    The vector to normalize.

    Vector3 result

    When the method completes, contains the normalized vector.

    Project(Vector3, Vector3)

    Projects a vector onto another vector.

    Declaration
    public static Vector3 Project(Vector3 vector, Vector3 onNormal)
    Parameters
    Vector3 vector

    The vector to project.

    Vector3 onNormal

    The projection normal vector.

    Returns
    Vector3

    The projected vector.

    Project(Vector3, Single, Single, Single, Single, Single, Single, Matrix)

    Projects a 3D vector from object space into screen space.

    Declaration
    public static Vector3 Project(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection)
    Parameters
    Vector3 vector

    The vector to project.

    System.Single x

    The X position of the viewport.

    System.Single y

    The Y position of the viewport.

    System.Single width

    The width of the viewport.

    System.Single height

    The height of the viewport.

    System.Single minZ

    The minimum depth of the viewport.

    System.Single maxZ

    The maximum depth of the viewport.

    Matrix worldViewProjection

    The combined world-view-projection matrix.

    Returns
    Vector3

    The vector in screen space.

    Project(ref Vector3, Single, Single, Single, Single, Single, Single, ref Matrix, out Vector3)

    Projects a 3D vector from object space into screen space.

    Declaration
    public static void Project(ref Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, ref Matrix worldViewProjection, out Vector3 result)
    Parameters
    Vector3 vector

    The vector to project.

    System.Single x

    The X position of the viewport.

    System.Single y

    The Y position of the viewport.

    System.Single width

    The width of the viewport.

    System.Single height

    The height of the viewport.

    System.Single minZ

    The minimum depth of the viewport.

    System.Single maxZ

    The maximum depth of the viewport.

    Matrix worldViewProjection

    The combined world-view-projection matrix.

    Vector3 result

    When the method completes, contains the vector in screen space.

    ProjectOnPlane(Vector3, Vector3)

    Projects a vector onto a plane defined by a normal orthogonal to the plane.

    Declaration
    public static Vector3 ProjectOnPlane(Vector3 vector, Vector3 planeNormal)
    Parameters
    Vector3 vector

    The vector to project.

    Vector3 planeNormal

    The plane normal vector.

    Returns
    Vector3

    The projected vector.

    Reflect(Vector3, Vector3)

    Returns the reflection of a vector off a surface that has the specified normal.

    Declaration
    public static Vector3 Reflect(Vector3 vector, Vector3 normal)
    Parameters
    Vector3 vector

    The source vector.

    Vector3 normal

    Normal of the surface.

    Returns
    Vector3

    The reflected vector.

    Remarks

    Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.

    Reflect(ref Vector3, ref Vector3, out Vector3)

    Returns the reflection of a vector off a surface that has the specified normal.

    Declaration
    public static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result)
    Parameters
    Vector3 vector

    The source vector.

    Vector3 normal

    Normal of the surface.

    Vector3 result

    When the method completes, contains the reflected vector.

    Remarks

    Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.

    SignedAngle(Vector3, Vector3, Vector3)

    Calculates the signed angle (in degrees) between from and to vectors. This is always the smallest value. The sign of the result depends on: the order of input vectors, and the direction of the axis vector.

    Declaration
    public static float SignedAngle(Vector3 from, Vector3 to, Vector3 axis)
    Parameters
    Vector3 from

    The first vector.

    Vector3 to

    The second vector.

    Vector3 axis

    The axis around which the vectors are rotated.

    Returns
    System.Single

    The angle (in degrees).

    SmoothDamp(Vector3, Vector3, ref Vector3, Single)

    Performs a gradual change of a vector towards a specified target over time

    Declaration
    public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime)
    Parameters
    Vector3 current

    Current vector.

    Vector3 target

    Target vector.

    Vector3 currentVelocity

    Used to store the current velocity.

    System.Single smoothTime

    Determines the approximate time it should take to reach the target vector.

    Returns
    Vector3

    SmoothDamp(Vector3, Vector3, ref Vector3, Single, Single)

    Performs a gradual change of a vector towards a specified target over time

    Declaration
    public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, float maxSpeed)
    Parameters
    Vector3 current

    Current vector.

    Vector3 target

    Target vector.

    Vector3 currentVelocity

    Used to store the current velocity.

    System.Single smoothTime

    Determines the approximate time it should take to reach the target vector.

    System.Single maxSpeed

    Defines the upper limit on the speed of the Smooth Damp.

    Returns
    Vector3

    SmoothDamp(Vector3, Vector3, ref Vector3, Single, Single, Single)

    Performs a gradual change of a vector towards a specified target over time

    Declaration
    public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, float maxSpeed, float deltaTime)
    Parameters
    Vector3 current

    Current vector.

    Vector3 target

    Target vector.

    Vector3 currentVelocity

    Used to store the current velocity.

    System.Single smoothTime

    Determines the approximate time it should take to reach the target vector.

    System.Single maxSpeed

    Defines the upper limit on the speed of the Smooth Damp.

    System.Single deltaTime

    Delta Time, represents the time elapsed since last frame.

    Returns
    Vector3

    SmoothStep(Vector3, Vector3, Single)

    Performs a cubic interpolation between two vectors.

    Declaration
    public static Vector3 SmoothStep(Vector3 start, Vector3 end, float amount)
    Parameters
    Vector3 start

    Start vector.

    Vector3 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Vector3

    The cubic interpolation of the two vectors.

    SmoothStep(ref Vector3, ref Vector3, Single, out Vector3)

    Performs a cubic interpolation between two vectors.

    Declaration
    public static void SmoothStep(ref Vector3 start, ref Vector3 end, float amount, out Vector3 result)
    Parameters
    Vector3 start

    Start vector.

    Vector3 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Vector3 result

    When the method completes, contains the cubic interpolation of the two vectors.

    SnapToGrid(Vector3, Vector3)

    Snaps the input position onto the grid.

    Declaration
    public static Vector3 SnapToGrid(Vector3 pos, Vector3 gridSize)
    Parameters
    Vector3 pos

    The position to snap.

    Vector3 gridSize

    The size of the grid.

    Returns
    Vector3

    The position snapped to the grid.

    SnapToGrid(Vector3, Vector3, Quaternion, Vector3, Vector3)

    Snaps the point onto the rotated grid.
    For world aligned grid snapping use SnapToGrid(Vector3, Vector3) instead.

    Example code:

    langword_csharp_public langword_csharp_class SnapToGridExample : Script
    langword_csharp_public Vector3 GridSize = One * 20.0f;
    langword_csharp_public Actor RayOrigin;
    langword_csharp_public Actor SomeObject;
    langword_csharp_public langword_csharp_override langword_csharp_void OnFixedUpdate()
    {
    langword_csharp_if (Physics.RayCast(RayOrigin.Position, RayOrigin.Transform.Forward, out RayCastHit hit) {
    Vector3 position = hit.Collider.Position; Transform transform = hit.Collider.Transform; Vector3 point = hit.Point; Vector3 normal = hit.Normal; //Get rotation from normal relative to collider transform Quaternion rot = Quaternion.GetRotationFromNormal(normal, transform); point = Vector3.SnapToGrid(point, GridSize, rot, position); SomeObject.Position = point; } } }

    Declaration
    public static Vector3 SnapToGrid(Vector3 point, Vector3 gridSize, Quaternion gridOrientation, Vector3 gridOrigin, Vector3 offset)
    Parameters
    Vector3 point

    The position to snap.

    Vector3 gridSize

    The size of the grid.

    Quaternion gridOrientation

    The rotation of the grid.

    Vector3 gridOrigin

    The center point of the grid.

    Vector3 offset

    The local position offset applied to the snapped position before grid rotation.

    Returns
    Vector3

    The position snapped to the grid.

    Subtract(Vector3, Vector3)

    Subtracts two vectors.

    Declaration
    public static Vector3 Subtract(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first vector to subtract.

    Vector3 right

    The second vector to subtract.

    Returns
    Vector3

    The difference of the two vectors.

    Subtract(Vector3, Single)

    Performs a component-wise subtraction.

    Declaration
    public static Vector3 Subtract(Vector3 left, float right)
    Parameters
    Vector3 left

    The input vector

    System.Single right

    The scalar value to be subtracted from elements

    Returns
    Vector3

    The vector with subtracted scalar for each element.

    Subtract(ref Vector3, ref Vector3, out Vector3)

    Subtracts two vectors.

    Declaration
    public static void Subtract(ref Vector3 left, ref Vector3 right, out Vector3 result)
    Parameters
    Vector3 left

    The first vector to subtract.

    Vector3 right

    The second vector to subtract.

    Vector3 result

    When the method completes, contains the difference of the two vectors.

    Subtract(ref Vector3, ref Single, out Vector3)

    Performs a component-wise subtraction.

    Declaration
    public static void Subtract(ref Vector3 left, ref float right, out Vector3 result)
    Parameters
    Vector3 left

    The input vector

    System.Single right

    The scalar value to be subtracted from elements

    Vector3 result

    The vector with subtracted scalar for each element.

    Subtract(Single, Vector3)

    Performs a component-wise subtraction.

    Declaration
    public static Vector3 Subtract(float left, Vector3 right)
    Parameters
    System.Single left

    The scalar value to be subtracted from elements

    Vector3 right

    The input vector.

    Returns
    Vector3

    The vector with subtracted scalar for each element.

    Subtract(ref Single, ref Vector3, out Vector3)

    Performs a component-wise subtraction.

    Declaration
    public static void Subtract(ref float left, ref Vector3 right, out Vector3 result)
    Parameters
    System.Single left

    The scalar value to be subtracted from elements

    Vector3 right

    The input vector.

    Vector3 result

    The vector with subtracted scalar for each element.

    ToArray()

    Creates an array containing the elements of the vector.

    Declaration
    public float[] ToArray()
    Returns
    System.Single[]

    A three-element array containing the components of the vector.

    ToString()

    Returns a System.String that represents this instance.

    Declaration
    public override string ToString()
    Returns
    System.String

    A System.String that represents this instance.

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(IFormatProvider formatProvider)
    Parameters
    System.IFormatProvider formatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this instance.

    ToString(String)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(string format)
    Parameters
    System.String format

    The format.

    Returns
    System.String

    A System.String that represents this instance.

    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    System.String format

    The format.

    System.IFormatProvider formatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this instance.

    Transform(Vector3, Matrix)

    Transforms a 3D vector by the given Matrix.

    Declaration
    public static Vector3 Transform(Vector3 vector, Matrix transform)
    Parameters
    Vector3 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Returns
    Vector3

    The transformed Vector4.

    Transform(Vector3, Matrix3x3)

    Transforms a 3D vector by the given Matrix3x3.

    Declaration
    public static Vector3 Transform(Vector3 vector, Matrix3x3 transform)
    Parameters
    Vector3 vector

    The source vector.

    Matrix3x3 transform

    The transformation Matrix3x3.

    Returns
    Vector3

    The transformed Vector3.

    Transform(Vector3, Quaternion)

    Transforms a 3D vector by the given Quaternion rotation.

    Declaration
    public static Vector3 Transform(Vector3 vector, Quaternion rotation)
    Parameters
    Vector3 vector

    The vector to rotate.

    Quaternion rotation

    The Quaternion rotation to apply.

    Returns
    Vector3

    The transformed Vector3.

    Transform(Vector3, Transform)

    Transforms a 3D vector by the given Transform.

    Declaration
    public static Vector3 Transform(Vector3 vector, Transform transform)
    Parameters
    Vector3 vector

    The source vector.

    Transform transform

    The transformation Transform.

    Returns
    Vector3

    The transformed Vector4.

    Transform(ref Vector3, ref Matrix, out Vector3)

    Transforms a 3D vector by the given Matrix.

    Declaration
    public static void Transform(ref Vector3 vector, ref Matrix transform, out Vector3 result)
    Parameters
    Vector3 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Vector3 result

    When the method completes, contains the transformed Vector3.

    Transform(ref Vector3, ref Matrix, out Vector4)

    Transforms a 3D vector by the given Matrix.

    Declaration
    public static void Transform(ref Vector3 vector, ref Matrix transform, out Vector4 result)
    Parameters
    Vector3 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Vector4 result

    When the method completes, contains the transformed Vector4.

    Transform(ref Vector3, ref Matrix3x3, out Vector3)

    Transforms a 3D vector by the given Matrix3x3.

    Declaration
    public static void Transform(ref Vector3 vector, ref Matrix3x3 transform, out Vector3 result)
    Parameters
    Vector3 vector

    The source vector.

    Matrix3x3 transform

    The transformation Matrix3x3.

    Vector3 result

    When the method completes, contains the transformed Vector3.

    Transform(ref Vector3, ref Quaternion, out Vector3)

    Transforms a 3D vector by the given Quaternion rotation.

    Declaration
    public static void Transform(ref Vector3 vector, ref Quaternion rotation, out Vector3 result)
    Parameters
    Vector3 vector

    The vector to rotate.

    Quaternion rotation

    The Quaternion rotation to apply.

    Vector3 result

    When the method completes, contains the transformed Vector3.

    Transform(ref Vector3, ref Transform, out Vector3)

    Transforms a 3D vector by the given Transform.

    Declaration
    public static void Transform(ref Vector3 vector, ref Transform transform, out Vector3 result)
    Parameters
    Vector3 vector

    The source vector.

    Transform transform

    The transformation Transform.

    Vector3 result

    When the method completes, contains the transformed Vector3.

    TransformCoordinate(Vector3, Matrix)

    Performs a coordinate transformation using the given Matrix.

    Declaration
    public static Vector3 TransformCoordinate(Vector3 coordinate, Matrix transform)
    Parameters
    Vector3 coordinate

    The coordinate vector to transform.

    Matrix transform

    The transformation Matrix.

    Returns
    Vector3

    The transformed coordinates.

    Remarks

    A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.

    TransformCoordinate(ref Vector3, ref Matrix, out Vector3)

    Performs a coordinate transformation using the given Matrix.

    Declaration
    public static void TransformCoordinate(ref Vector3 coordinate, ref Matrix transform, out Vector3 result)
    Parameters
    Vector3 coordinate

    The coordinate vector to transform.

    Matrix transform

    The transformation Matrix.

    Vector3 result

    When the method completes, contains the transformed coordinates.

    Remarks

    A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.

    TransformNormal(Vector3, Matrix)

    Performs a normal transformation using the given Matrix.

    Declaration
    public static Vector3 TransformNormal(Vector3 normal, Matrix transform)
    Parameters
    Vector3 normal

    The normal vector to transform.

    Matrix transform

    The transformation Matrix.

    Returns
    Vector3

    The transformed normal.

    Remarks

    A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.

    TransformNormal(ref Vector3, ref Matrix, out Vector3)

    Performs a normal transformation using the given Matrix.

    Declaration
    public static void TransformNormal(ref Vector3 normal, ref Matrix transform, out Vector3 result)
    Parameters
    Vector3 normal

    The normal vector to transform.

    Matrix transform

    The transformation Matrix.

    Vector3 result

    When the method completes, contains the transformed normal.

    Remarks

    A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.

    Unproject(Vector3, Single, Single, Single, Single, Single, Single, Matrix)

    Projects a 3D vector from screen space into object space.

    Declaration
    public static Vector3 Unproject(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection)
    Parameters
    Vector3 vector

    The vector to project.

    System.Single x

    The X position of the viewport.

    System.Single y

    The Y position of the viewport.

    System.Single width

    The width of the viewport.

    System.Single height

    The height of the viewport.

    System.Single minZ

    The minimum depth of the viewport.

    System.Single maxZ

    The maximum depth of the viewport.

    Matrix worldViewProjection

    The combined world-view-projection matrix.

    Returns
    Vector3

    The vector in object space.

    Unproject(ref Vector3, Single, Single, Single, Single, Single, Single, ref Matrix, out Vector3)

    Projects a 3D vector from screen space into object space.

    Declaration
    public static void Unproject(ref Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, ref Matrix worldViewProjection, out Vector3 result)
    Parameters
    Vector3 vector

    The vector to project.

    System.Single x

    The X position of the viewport.

    System.Single y

    The Y position of the viewport.

    System.Single width

    The width of the viewport.

    System.Single height

    The height of the viewport.

    System.Single minZ

    The minimum depth of the viewport.

    System.Single maxZ

    The maximum depth of the viewport.

    Matrix worldViewProjection

    The combined world-view-projection matrix.

    Vector3 result

    When the method completes, contains the vector in object space.

    Operators

    Addition(Float3, Vector3)

    Adds a vector to another by performing component-wise addition.

    Declaration
    public static Float3 operator +(Float3 left, Vector3 right)
    Parameters
    Float3 left

    The first vector to add.

    Vector3 right

    The second vector to add.

    Returns
    Float3

    The sum of the two vectors.

    Addition(Vector3, Float3)

    Adds a vector to another by performing component-wise addition.

    Declaration
    public static Vector3 operator +(Vector3 left, Float3 right)
    Parameters
    Vector3 left

    The first vector to add.

    Float3 right

    The second vector to add.

    Returns
    Vector3

    The sum of the two vectors.

    Addition(Vector3, Vector3)

    Adds two vectors.

    Declaration
    public static Vector3 operator +(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first vector to add.

    Vector3 right

    The second vector to add.

    Returns
    Vector3

    The sum of the two vectors.

    Addition(Vector3, Single)

    Performs a component-wise addition.

    Declaration
    public static Vector3 operator +(Vector3 value, float scalar)
    Parameters
    Vector3 value

    The input vector.

    System.Single scalar

    The scalar value to be added on elements

    Returns
    Vector3

    The vector with added scalar for each element.

    Addition(Single, Vector3)

    Performs a component-wise addition.

    Declaration
    public static Vector3 operator +(float scalar, Vector3 value)
    Parameters
    System.Single scalar

    The scalar value to be added on elements

    Vector3 value

    The input vector.

    Returns
    Vector3

    The vector with added scalar for each element.

    Division(Vector3, Vector3)

    Scales a vector by the given value.

    Declaration
    public static Vector3 operator /(Vector3 value, Vector3 scale)
    Parameters
    Vector3 value

    The vector to scale.

    Vector3 scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The scaled vector.

    Division(Vector3, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector3 operator /(Vector3 value, float scale)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The scaled vector.

    Division(Single, Vector3)

    Scales a vector by the given value.

    Declaration
    public static Vector3 operator /(float scale, Vector3 value)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector3 value

    The vector to scale.

    Returns
    Vector3

    The scaled vector.

    Equality(Vector3, Vector3)

    Tests for equality between two objects.

    Declaration
    public static bool operator ==(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first value to compare.

    Vector3 right

    The second value to compare.

    Returns
    System.Boolean

    true if left has the same value as right; otherwise, false.

    Explicit(Vector3 to Int3)

    Performs an explicit conversion from Vector3 to Int3.

    Declaration
    public static explicit operator Int3(Vector3 value)
    Parameters
    Vector3 value

    The value.

    Returns
    Int3

    The result of the conversion.

    Explicit(Vector3 to Vector2)

    Performs an explicit conversion from Vector3 to Vector2.

    Declaration
    public static explicit operator Vector2(Vector3 value)
    Parameters
    Vector3 value

    The value.

    Returns
    Vector2

    The result of the conversion.

    Explicit(Vector3 to Vector4)

    Performs an explicit conversion from Vector3 to Vector4.

    Declaration
    public static explicit operator Vector4(Vector3 value)
    Parameters
    Vector3 value

    The value.

    Returns
    Vector4

    The result of the conversion.

    Implicit(Vector3 to Double3)

    Performs an implicit conversion from Vector3 to Double3.

    Declaration
    public static implicit operator Double3(Vector3 value)
    Parameters
    Vector3 value

    The value.

    Returns
    Double3

    The result of the conversion.

    Implicit(Vector3 to Float3)

    Performs an implicit conversion from Vector3 to Float3.

    Declaration
    public static implicit operator Float3(Vector3 value)
    Parameters
    Vector3 value

    The value.

    Returns
    Float3

    The result of the conversion.

    Inequality(Vector3, Vector3)

    Tests for inequality between two objects.

    Declaration
    public static bool operator !=(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first value to compare.

    Vector3 right

    The second value to compare.

    Returns
    System.Boolean

    true if left has a different value than right; otherwise, false.

    Modulus(Vector3, Vector3)

    Remainder of value divided by scale.

    Declaration
    public static Vector3 operator %(Vector3 value, Vector3 scale)
    Parameters
    Vector3 value

    The vector to scale.

    Vector3 scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The remained vector.

    Modulus(Vector3, Single)

    Remainder of value divided by scale.

    Declaration
    public static Vector3 operator %(Vector3 value, float scale)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The remained vector.

    Modulus(Single, Vector3)

    Remainder of value divided by scale.

    Declaration
    public static Vector3 operator %(float value, Vector3 scale)
    Parameters
    System.Single value

    The amount by which to scale the vector.

    Vector3 scale

    The vector to scale.

    Returns
    Vector3

    The remained vector.

    Multiply(Float3, Vector3)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static Float3 operator *(Float3 left, Vector3 right)
    Parameters
    Float3 left

    The first vector to multiply.

    Vector3 right

    The second vector to multiply.

    Returns
    Float3

    The multiplication of the two vectors.

    Multiply(Vector3, Float3)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static Vector3 operator *(Vector3 left, Float3 right)
    Parameters
    Vector3 left

    The first vector to multiply.

    Float3 right

    The second vector to multiply.

    Returns
    Vector3

    The multiplication of the two vectors.

    Multiply(Vector3, Quaternion)

    Transforms a vector by the given rotation.

    Declaration
    public static Vector3 operator *(Vector3 vector, Quaternion rotation)
    Parameters
    Vector3 vector

    The vector to transform.

    Quaternion rotation

    The quaternion.

    Returns
    Vector3

    The scaled vector.

    Multiply(Vector3, Vector3)

    Multiplies a vector with another by performing component-wise multiplication equivalent to Multiply(ref Vector3, ref Vector3, out Vector3).

    Declaration
    public static Vector3 operator *(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first vector to multiply.

    Vector3 right

    The second vector to multiply.

    Returns
    Vector3

    The multiplication of the two vectors.

    Multiply(Vector3, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector3 operator *(Vector3 value, float scale)
    Parameters
    Vector3 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector3

    The scaled vector.

    Multiply(Single, Vector3)

    Scales a vector by the given value.

    Declaration
    public static Vector3 operator *(float scale, Vector3 value)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector3 value

    The vector to scale.

    Returns
    Vector3

    The scaled vector.

    Subtraction(Float3, Vector3)

    Subtracts a vector from another by performing component-wise subtraction.

    Declaration
    public static Float3 operator -(Float3 left, Vector3 right)
    Parameters
    Float3 left

    The first vector to add.

    Vector3 right

    The second vector to add.

    Returns
    Float3

    The sum of the two vectors.

    Subtraction(Vector3, Float3)

    Subtracts a vector from another by performing component-wise subtraction.

    Declaration
    public static Vector3 operator -(Vector3 left, Float3 right)
    Parameters
    Vector3 left

    The first vector to add.

    Float3 right

    The second vector to add.

    Returns
    Vector3

    The sum of the two vectors.

    Subtraction(Vector3, Vector3)

    Subtracts two vectors.

    Declaration
    public static Vector3 operator -(Vector3 left, Vector3 right)
    Parameters
    Vector3 left

    The first vector to subtract.

    Vector3 right

    The second vector to subtract.

    Returns
    Vector3

    The difference of the two vectors.

    Subtraction(Vector3, Single)

    Performs a component-wise subtraction.

    Declaration
    public static Vector3 operator -(Vector3 value, float scalar)
    Parameters
    Vector3 value

    The input vector.

    System.Single scalar

    The scalar value to be subtracted from elements

    Returns
    Vector3

    The vector with added scalar from each element.

    Subtraction(Single, Vector3)

    Performs a component-wise subtraction.

    Declaration
    public static Vector3 operator -(float scalar, Vector3 value)
    Parameters
    System.Single scalar

    The scalar value to be subtracted from elements

    Vector3 value

    The input vector.

    Returns
    Vector3

    The vector with subtracted scalar from each element.

    UnaryNegation(Vector3)

    Reverses the direction of a given vector.

    Declaration
    public static Vector3 operator -(Vector3 value)
    Parameters
    Vector3 value

    The vector to negate.

    Returns
    Vector3

    A vector facing in the opposite direction.

    UnaryPlus(Vector3)

    Assert a vector (return it unchanged).

    Declaration
    public static Vector3 operator +(Vector3 value)
    Parameters
    Vector3 value

    The vector to assert (unchanged).

    Returns
    Vector3

    The asserted (unchanged) vector.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat