Search Results for

    Show / Hide Table of Contents

    Class PhysicsUtils

    Collection of functions for abstracting more complex physics operations.

    Inheritance
    Object
    PhysicsUtils
    Namespace: nickmaltbie.OpenKCC.Utils
    Assembly: cs.temp.dll.dll
    Syntax
    public static class PhysicsUtils

    Methods

    FilterForFirstHitAllow(GameObject, IEnumerable<RaycastHit>, out RaycastHit)

    Filters a set of raycast hits for the first hit that is of a collider attached ot a specific object

    Declaration
    public static bool FilterForFirstHitAllow(GameObject allow, IEnumerable<RaycastHit> hits, out RaycastHit closest)
    Parameters
    Type Name Description
    GameObject allow

    Only game object that will be searched for

    IEnumerable<RaycastHit> hits

    All of the hits to process

    RaycastHit closest

    Closest hit that is attached to the ignored object

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise

    FilterForFirstHitAllow(ICollection<GameObject>, IEnumerable<RaycastHit>, out RaycastHit)

    Filters a set of raycast hits for the first hit that is of a collider attached ot a specific object

    Declaration
    public static bool FilterForFirstHitAllow(ICollection<GameObject> allowList, IEnumerable<RaycastHit> hits, out RaycastHit closest)
    Parameters
    Type Name Description
    ICollection<GameObject> allowList
    IEnumerable<RaycastHit> hits

    All of the hits to process

    RaycastHit closest

    Closest hit that is attached to the ignored object

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise

    FilterForFirstHitIgnore(GameObject, IEnumerable<RaycastHit>, out RaycastHit)

    Filters a set of raycast hits for the first hit that is not of a collider attached to a given game object

    Declaration
    public static bool FilterForFirstHitIgnore(GameObject ignore, IEnumerable<RaycastHit> hits, out RaycastHit closest)
    Parameters
    Type Name Description
    GameObject ignore

    Game object to ignore when checking for collider hit

    IEnumerable<RaycastHit> hits

    All of the hits to process

    RaycastHit closest

    Closest hit that is attached to the ignored object

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise

    FilterForFirstHitIgnore(ICollection<GameObject>, IEnumerable<RaycastHit>, out RaycastHit)

    Filters a set of raycast hits for the first hit that is not of a collider attached to a given game object

    Declaration
    public static bool FilterForFirstHitIgnore(ICollection<GameObject> ignoreList, IEnumerable<RaycastHit> hits, out RaycastHit closest)
    Parameters
    Type Name Description
    ICollection<GameObject> ignoreList

    Game objects to ignore when checking for collider hit

    IEnumerable<RaycastHit> hits

    All of the hits to process

    RaycastHit closest

    Closest hit that is attached to the ignored object

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise

    RaycastFirstHitIgnore(GameObject, Vector3, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while ignoring a given object for a raycast. Will include overlapping objects if objects overlap.

    Declaration
    public static bool RaycastFirstHitIgnore(GameObject ignore, Vector3 source, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    GameObject ignore

    Object to ignore from raycast

    Vector3 source

    Source position of raycast

    Vector3 direction

    Direction of raycast

    Single distance

    Distance of raycast

    LayerMask layerMask

    Laymask for raycast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for raycast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    RaycastFirstHitIgnore(ICollection<GameObject>, Vector3, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while ignoring a given object for a raycast. Will include overlapping objects if objects overlap.

    Declaration
    public static bool RaycastFirstHitIgnore(ICollection<GameObject> ignoreList, Vector3 source, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    ICollection<GameObject> ignoreList

    Object to ignore from raycast

    Vector3 source

    Source position of raycast

    Vector3 direction

    Direction of raycast

    Single distance

    Distance of raycast

    LayerMask layerMask

    Laymask for raycast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for raycast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    RaycastHitAllow(GameObject, Vector3, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while only looking for colliders attached to a specific object

    Declaration
    public static bool RaycastHitAllow(GameObject target, Vector3 source, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    GameObject target

    Object search for given raycast

    Vector3 source

    Source position of raycast

    Vector3 direction

    Direction of raycast

    Single distance

    Distance of raycast

    LayerMask layerMask

    Laymask for raycast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for raycast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    RaycastHitAllow(ICollection<GameObject>, Vector3, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while only looking for colliders attached to a specific object

    Declaration
    public static bool RaycastHitAllow(ICollection<GameObject> allowList, Vector3 source, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    ICollection<GameObject> allowList
    Vector3 source

    Source position of raycast

    Vector3 direction

    Direction of raycast

    Single distance

    Distance of raycast

    LayerMask layerMask

    Laymask for raycast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for raycast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    SphereCastAllow(GameObject, Vector3, Single, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while only looking for colliders attached to a specific object

    Declaration
    public static bool SphereCastAllow(GameObject target, Vector3 source, float radius, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    GameObject target

    Object search for given raycast

    Vector3 source

    Source position of raycast

    Single radius

    Radius spherecast

    Vector3 direction

    Direction of raycast

    Single distance

    Distance of raycast

    LayerMask layerMask

    Layer mask for raycast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for raycast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    SphereCastFirstHitIgnore(GameObject, Vector3, Single, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while ignoring a given object for a spherecast. Will include overlapping objects if objects overlap.

    Declaration
    public static bool SphereCastFirstHitIgnore(GameObject ignore, Vector3 source, float radius, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    GameObject ignore

    Object to ignore from spherecast

    Vector3 source

    Source position of spherecast

    Single radius

    Radius spherecast

    Vector3 direction

    Direction of spherecast

    Single distance

    Distance of spherecast

    LayerMask layerMask

    Laymask for spherecast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for spherecast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    SphereCastFirstHitIgnore(ICollection<GameObject>, Vector3, Single, Vector3, Single, LayerMask, QueryTriggerInteraction, out RaycastHit)

    Compute the first object hit while ignoring a given object for a spherecast. Will include overlapping objects if objects overlap.

    Declaration
    public static bool SphereCastFirstHitIgnore(ICollection<GameObject> ignoreList, Vector3 source, float radius, Vector3 direction, float distance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction, out RaycastHit closest)
    Parameters
    Type Name Description
    ICollection<GameObject> ignoreList

    Objects to ignore from spherecast

    Vector3 source

    Source position of spherecast

    Single radius

    Radius spherecast

    Vector3 direction

    Direction of spherecast

    Single distance

    Distance of spherecast

    LayerMask layerMask

    Laymask for spherecast

    QueryTriggerInteraction queryTriggerInteraction

    Query trigger interaction for spherecast

    RaycastHit closest

    The closest raycast hit event

    Returns
    Type Description
    Boolean

    True if a hit was detected, false otherwise.

    In This Article
    Back to top OpenKCC Documentation