Search Results for

    Show / Hide Table of Contents

    Class Vector2Extensions

    UnityEngine.Vector2 Based Extension Methods

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

    Methods

    | Improve this Doc View Source

    Approximately(Vector2, Vector2)

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

    Declaration
    public static bool Approximately(this Vector2 targetVector2, Vector2 otherVector2)
    Parameters
    Type Name Description
    UnityEngine.Vector2 targetVector2

    Point A

    UnityEngine.Vector2 otherVector2

    Point B

    Returns
    Type Description
    System.Boolean

    Are the two UnityEngine.Vector2 approximately the same?

    Remarks

    Includes optimized Unity.Mathematics approach.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    Midpoint(Vector2, Vector2)

    Get the midpoint between two UnityEngine.Vector2s.

    Declaration
    public static Vector2 Midpoint(this Vector2 targetVector2, Vector2 otherVector2)
    Parameters
    Type Name Description
    UnityEngine.Vector2 targetVector2

    Point A

    UnityEngine.Vector2 otherVector2

    Point B

    Returns
    Type Description
    UnityEngine.Vector2

    The midpoint between targetVector2 and otherVector2.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    NearestIndex(Vector2, Vector2[])

    Find the index of the UnityEngine.Vector2 in otherVector2 that is nearest to the targetVector2.

    Declaration
    public static int NearestIndex(this Vector2 targetVector2, Vector2[] otherVector2)
    Parameters
    Type Name Description
    UnityEngine.Vector2 targetVector2

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

    UnityEngine.Vector2[] otherVector2

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

    Returns
    Type Description
    System.Int32

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

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    Slope(Vector2)

    Get the slope of a UnityEngine.Vector2.

    Declaration
    public static float Slope(this Vector2 targetVector2)
    Parameters
    Type Name Description
    UnityEngine.Vector2 targetVector2

    The UnityEngine.Vector2 to evaluate.

    Returns
    Type Description
    System.Single

    The slope value.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    TryParseVector2(String, out Vector2)

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

    Declaration
    public static bool TryParseVector2(this string targetString, out Vector2 outputVector2)
    Parameters
    Type Name Description
    System.String targetString

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

    UnityEngine.Vector2 outputVector2

    The outputted UnityEngine.Vector2.

    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.