Search Results for

    Show / Hide Table of Contents

    Class KaijuAgentsHasSight

    Extension methods to see if there is a direct line of sight between two positions across all axes. Any Vector2 values will be expanded via the Expand(Vector2) method.

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

    Methods

    HasSight(Component, Component, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Component position, Component target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Component, Component, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Component position, Component target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Component, GameObject, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Component position, GameObject target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Component, GameObject, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Component position, GameObject target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Component, Transform, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Component position, Transform target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Component, Transform, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Component position, Transform target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Component, Vector2, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Component position, Vector2 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Component, Vector2, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Component position, Vector2 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Component, Vector3, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Component position, Vector3 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Component, Vector3, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Component position, Vector3 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Component position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(GameObject, Component, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this GameObject position, Component target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(GameObject, Component, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this GameObject position, Component target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(GameObject, GameObject, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this GameObject position, GameObject target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(GameObject, GameObject, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this GameObject position, GameObject target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(GameObject, Transform, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this GameObject position, Transform target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(GameObject, Transform, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this GameObject position, Transform target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(GameObject, Vector2, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this GameObject position, Vector2 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(GameObject, Vector2, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this GameObject position, Vector2 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(GameObject, Vector3, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this GameObject position, Vector3 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(GameObject, Vector3, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this GameObject position, Vector3 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    GameObject position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Transform, Component, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Transform position, Component target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Transform, Component, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Transform position, Component target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Transform, GameObject, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Transform position, GameObject target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Transform, GameObject, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Transform position, GameObject target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Transform, Transform, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Transform position, Transform target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Transform, Transform, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Transform position, Transform target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Transform, Vector2, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Transform position, Vector2 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Transform, Vector2, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Transform position, Vector2 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Transform, Vector3, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Transform position, Vector3 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Transform, Vector3, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Transform position, Vector3 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Transform position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Vector2, Component, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector2 position, Component target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector2, Component, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector2 position, Component target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector2, GameObject, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector2 position, GameObject target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector2, GameObject, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector2 position, GameObject target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector2, Transform, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector2 position, Transform target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector2, Transform, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector2 position, Transform target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector2, Vector2, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector2 position, Vector2 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Vector2, Vector2, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector2 position, Vector2 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Vector2, Vector3, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector2 position, Vector3 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Vector2, Vector3, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector2 position, Vector3 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector2 position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Vector3, Component, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector3 position, Component target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector3, Component, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector3 position, Component target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Component target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector3, GameObject, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector3 position, GameObject target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector3, GameObject, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector3 position, GameObject target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    GameObject target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector3, Transform, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector3 position, Transform target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector3, Transform, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    Declaration
    public static bool HasSight(this Vector3 position, Transform target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Transform target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position, or the hit during the line of sight check was the target.

    HasSight(Vector3, Vector2, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector3 position, Vector2 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Vector3, Vector2, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector3 position, Vector2 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Vector2 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    HasSight(Vector3, Vector3, out RaycastHit, Int32, QueryTriggerInteraction)

    If there is a direct line of sight from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector3 position, Vector3 target, out RaycastHit hit, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight from a starting position to an end position.

    HasSight(Vector3, Vector3, out RaycastHit, Single, Int32, QueryTriggerInteraction)

    If there is a direct line of sight with a given radius from a starting position to an end position.

    Declaration
    public static bool HasSight(this Vector3 position, Vector3 target, out RaycastHit hit, float radius, int mask = -5, QueryTriggerInteraction triggers = null)
    Parameters
    Type Name Description
    Vector3 position

    The starting position of the line of sight.

    Vector3 target

    The ending position of the line of sight.

    RaycastHit hit

    The hit information from the line of sight check.

    System.Single radius

    How wide of a sphere to cast.

    System.Int32 mask

    The optional layer mask.

    QueryTriggerInteraction triggers

    How the check should handle hitting triggers.

    Returns
    Type Description
    System.Boolean

    If there is a direct line of sight with a given radius from a starting position to an end position.

    In This Article
    Back to top MIT License © 2026 Kaiju Solutions Inc.