Search Results for

    Show / Hide Table of Contents

    Class Vector3Extensions

    UnityEngine.Vector3 Based Extension Methods

    Inheritance
    System.Object
    Vector3Extensions
    Namespace: GDX
    Syntax
    [VisualScriptingCompatible((short)2)]
    public static class Vector3Extensions

    Methods

    | Improve this Doc View Source

    Approximately(Vector3, Vector3)

    Is one UnityEngine.Vector3 approximately similar to another UnityEngine.Vector3?

    Declaration
    public static bool Approximately(this Vector3 targetVector3, Vector3 otherVector3)
    Parameters
    Type Name Description
    UnityEngine.Vector3 targetVector3

    Point A

    UnityEngine.Vector3 otherVector3

    Point B

    Returns
    Type Description
    System.Boolean

    Are the two UnityEngine.Vector3 approximately the same?

    Remarks

    Includes optimized Unity.Mathematics approach.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    DistanceSqr(Vector3, Vector3)

    Calculate the squared distance between two UnityEngine.Vector3.

    Declaration
    public static float DistanceSqr(this Vector3 targetVector3, Vector3 otherVector3)
    Parameters
    Type Name Description
    UnityEngine.Vector3 targetVector3

    Point A

    UnityEngine.Vector3 otherVector3

    Point B

    Returns
    Type Description
    System.Single

    The squared distance.

    Remarks

    Based on https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    DistanceToRay(Vector3, Ray)

    Calculate the distance from a UnityEngine.Vector3 to a UnityEngine.Ray.

    Declaration
    public static float DistanceToRay(this Vector3 targetVector3, Ray targetRay)
    Parameters
    Type Name Description
    UnityEngine.Vector3 targetVector3

    The position.

    UnityEngine.Ray targetRay

    The line.

    Returns
    Type Description
    System.Single

    The distance.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    HorizontalDistance(Vector3, Vector3)

    Get the horizontal distance between two UnityEngine.Vector3 points.

    Declaration
    public static float HorizontalDistance(this Vector3 targetVector3, Vector3 otherVector3)
    Parameters
    Type Name Description
    UnityEngine.Vector3 targetVector3

    Point A

    UnityEngine.Vector3 otherVector3

    Point B

    Returns
    Type Description
    System.Single

    The horizontal distance.

    Remarks

    Ignores the Y-axis completely.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    Midpoint(Vector3, Vector3)

    Get the midpoint between two UnityEngine.Vector3s.

    Declaration
    public static Vector3 Midpoint(this Vector3 targetVector3, Vector3 otherVector3)
    Parameters
    Type Name Description
    UnityEngine.Vector3 targetVector3

    Point A

    UnityEngine.Vector3 otherVector3

    Point B

    Returns
    Type Description
    UnityEngine.Vector3

    The midpoint between targetVector3 and otherVector3.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    NearestIndex(Vector3, Vector3[])

    Find the index of the UnityEngine.Vector3 in otherVector3 that is nearest to the targetVector3.

    Declaration
    public static int NearestIndex(this Vector3 targetVector3, Vector3[] otherVector3)
    Parameters
    Type Name Description
    UnityEngine.Vector3 targetVector3

    The UnityEngine.Vector3 to use as the point of reference.

    UnityEngine.Vector3[] otherVector3

    An array of UnityEngine.Vector3 positions to evaluate for which one is nearest.

    Returns
    Type Description
    System.Int32

    The index of the nearest otherVector3 element to targetVector3. Returning -1 if the the otherVector3 has no elements or is null.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    TryParseVector3(String, out Vector3)

    Attempt to parse a System.String into a UnityEngine.Vector3.

    Declaration
    public static bool TryParseVector3(this string targetString, out Vector3 outputVector3)
    Parameters
    Type Name Description
    System.String targetString

    The System.String to convert into a UnityEngine.Vector3 if possible.

    UnityEngine.Vector3 outputVector3

    The outputted UnityEngine.Vector3.

    Returns
    Type Description
    System.Boolean

    true/false if the conversion was successful.

    Remarks

    This isn't great for runtime performance, it should be used predominantly when reconstructing data.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Built on 2024-01-01 against 1f69a68.
    Generated by Dox+DocFX.