Search Results for

    Show / Hide Table of Contents

    Class KaijuAgentsFarthest

    Extension methods to get the farthest object from a given position along the X and Z axes. All three-dimensional vectors will be flattened via methods in KaijuAgentsFlatten.

    Inheritance
    System.Object
    KaijuAgentsFarthest
    Namespace: KaijuSolutions.Agents.Extensions
    Syntax
    public static class KaijuAgentsFarthest

    Methods

    Farthest(Component, IEnumerable<GameObject>, out Single)

    The farthest instance from a position.

    Declaration
    public static GameObject Farthest(this Component position, IEnumerable<GameObject> targets, out float distance)
    Parameters
    Type Name Description
    Component position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<GameObject> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    GameObject

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Component, IEnumerable<Transform>, out Single)

    The farthest instance from a position.

    Declaration
    public static Transform Farthest(this Component position, IEnumerable<Transform> targets, out float distance)
    Parameters
    Type Name Description
    Component position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Transform> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Transform

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Component, IEnumerable<Vector2>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector2 Farthest(this Component position, IEnumerable<Vector2> targets, out float distance)
    Parameters
    Type Name Description
    Component position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector2> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector2

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Component, IEnumerable<Vector3>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector3 Farthest(this Component position, IEnumerable<Vector3> targets, out float distance)
    Parameters
    Type Name Description
    Component position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector3> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector3

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(GameObject, IEnumerable<GameObject>, out Single)

    The farthest instance from a position.

    Declaration
    public static GameObject Farthest(this GameObject position, IEnumerable<GameObject> targets, out float distance)
    Parameters
    Type Name Description
    GameObject position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<GameObject> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    GameObject

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(GameObject, IEnumerable<Transform>, out Single)

    The farthest instance from a position.

    Declaration
    public static Transform Farthest(this GameObject position, IEnumerable<Transform> targets, out float distance)
    Parameters
    Type Name Description
    GameObject position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Transform> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Transform

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(GameObject, IEnumerable<Vector2>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector2 Farthest(this GameObject position, IEnumerable<Vector2> targets, out float distance)
    Parameters
    Type Name Description
    GameObject position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector2> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector2

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(GameObject, IEnumerable<Vector3>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector3 Farthest(this GameObject position, IEnumerable<Vector3> targets, out float distance)
    Parameters
    Type Name Description
    GameObject position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector3> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector3

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Transform, IEnumerable<GameObject>, out Single)

    The farthest instance from a position.

    Declaration
    public static GameObject Farthest(this Transform position, IEnumerable<GameObject> targets, out float distance)
    Parameters
    Type Name Description
    Transform position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<GameObject> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    GameObject

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Transform, IEnumerable<Transform>, out Single)

    The farthest instance from a position.

    Declaration
    public static Transform Farthest(this Transform position, IEnumerable<Transform> targets, out float distance)
    Parameters
    Type Name Description
    Transform position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Transform> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Transform

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Transform, IEnumerable<Vector2>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector2 Farthest(this Transform position, IEnumerable<Vector2> targets, out float distance)
    Parameters
    Type Name Description
    Transform position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector2> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector2

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Transform, IEnumerable<Vector3>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector3 Farthest(this Transform position, IEnumerable<Vector3> targets, out float distance)
    Parameters
    Type Name Description
    Transform position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector3> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector3

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Vector2, IEnumerable<GameObject>, out Single)

    The farthest instance from a position.

    Declaration
    public static GameObject Farthest(this Vector2 position, IEnumerable<GameObject> targets, out float distance)
    Parameters
    Type Name Description
    Vector2 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<GameObject> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    GameObject

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Vector2, IEnumerable<Transform>, out Single)

    The farthest instance from a position.

    Declaration
    public static Transform Farthest(this Vector2 position, IEnumerable<Transform> targets, out float distance)
    Parameters
    Type Name Description
    Vector2 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Transform> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Transform

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Vector2, IEnumerable<Vector2>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector2 Farthest(this Vector2 position, IEnumerable<Vector2> targets, out float distance)
    Parameters
    Type Name Description
    Vector2 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector2> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector2

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Vector2, IEnumerable<Vector3>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector3 Farthest(this Vector2 position, IEnumerable<Vector3> targets, out float distance)
    Parameters
    Type Name Description
    Vector2 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector3> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector3

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Vector3, IEnumerable<GameObject>, out Single)

    The farthest instance from a position.

    Declaration
    public static GameObject Farthest(this Vector3 position, IEnumerable<GameObject> targets, out float distance)
    Parameters
    Type Name Description
    Vector3 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<GameObject> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    GameObject

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Vector3, IEnumerable<Transform>, out Single)

    The farthest instance from a position.

    Declaration
    public static Transform Farthest(this Vector3 position, IEnumerable<Transform> targets, out float distance)
    Parameters
    Type Name Description
    Vector3 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Transform> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Transform

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Farthest(Vector3, IEnumerable<Vector2>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector2 Farthest(this Vector3 position, IEnumerable<Vector2> targets, out float distance)
    Parameters
    Type Name Description
    Vector3 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector2> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector2

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest(Vector3, IEnumerable<Vector3>, out Single)

    The farthest instance from a position.

    Declaration
    public static Vector3 Farthest(this Vector3 position, IEnumerable<Vector3> targets, out float distance)
    Parameters
    Type Name Description
    Vector3 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<Vector3> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    Vector3

    The farthest instance from the targets to the position. Will be the starting position if the targets list is empty.

    Farthest<T>(Component, IEnumerable<T>, out Single)

    The farthest instance from a position.

    Declaration
    public static T Farthest<T>(this Component position, IEnumerable<T> targets, out float distance)
        where T : Component
    Parameters
    Type Name Description
    Component position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<T> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    T

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Type Parameters
    Name Description
    T

    Farthest<T>(GameObject, IEnumerable<T>, out Single)

    The farthest instance from a position.

    Declaration
    public static T Farthest<T>(this GameObject position, IEnumerable<T> targets, out float distance)
        where T : Component
    Parameters
    Type Name Description
    GameObject position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<T> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    T

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Type Parameters
    Name Description
    T

    Farthest<T>(Transform, IEnumerable<T>, out Single)

    The farthest instance from a position.

    Declaration
    public static T Farthest<T>(this Transform position, IEnumerable<T> targets, out float distance)
        where T : Component
    Parameters
    Type Name Description
    Transform position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<T> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    T

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Type Parameters
    Name Description
    T

    Farthest<T>(Vector2, IEnumerable<T>, out Single)

    The farthest instance from a position.

    Declaration
    public static T Farthest<T>(this Vector2 position, IEnumerable<T> targets, out float distance)
        where T : Component
    Parameters
    Type Name Description
    Vector2 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<T> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    T

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Type Parameters
    Name Description
    T

    Farthest<T>(Vector3, IEnumerable<T>, out Single)

    The farthest instance from a position.

    Declaration
    public static T Farthest<T>(this Vector3 position, IEnumerable<T> targets, out float distance)
        where T : Component
    Parameters
    Type Name Description
    Vector3 position

    The position to get the farthest target instance from.

    System.Collections.Generic.IEnumerable<T> targets

    The targets to get the farthest from.

    System.Single distance

    The distance to the farthest target.

    Returns
    Type Description
    T

    The farthest instance from the targets to the position. Will be NULL if the targets list is empty.

    Type Parameters
    Name Description
    T
    In This Article
    Back to top MIT License © 2026 Kaiju Solutions Inc.