docs.unity3d.com
    Show / Hide Table of Contents

    Struct ColliderAspect

    A collider aspect. Contains transform data and a collider.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Physics.Aspects
    Syntax
    public readonly struct ColliderAspect : IAspect, IQueryTypeParameter, IAspectQueryable, ICollidable

    Fields

    Entity

    The entity of this aspect.

    Declaration
    public readonly Entity Entity
    Field Value
    Type Description
    Entity

    Properties

    Collider

    Gets or sets the collider.

    Declaration
    public readonly BlobAssetReference<Collider> Collider { get; set; }
    Property Value
    Type Description
    BlobAssetReference<Collider>

    The collider.

    CollisionType

    Gets the collision type.

    Declaration
    public readonly CollisionType CollisionType { get; }
    Property Value
    Type Description
    CollisionType

    The collision type.

    Position

    Gets or sets the world space position.

    Declaration
    public readonly float3 Position { get; set; }
    Property Value
    Type Description
    float3

    The world space position.

    Rotation

    Gets or sets the world space rotation.

    Declaration
    public readonly quaternion Rotation { get; set; }
    Property Value
    Type Description
    quaternion

    The world space rotation.

    Scale

    Gets or sets the uniform scale.

    Declaration
    public readonly float Scale { get; set; }
    Property Value
    Type Description
    Single

    The scale.

    Type

    Gets the collider type.

    Declaration
    public readonly ColliderType Type { get; }
    Property Value
    Type Description
    ColliderType

    The colldier type.

    WorldFromCollider

    Gets or sets the world transform of a collider aspect.

    Declaration
    public readonly LocalTransform WorldFromCollider { get; set; }
    Property Value
    Type Description
    LocalTransform

    The world space transform.

    Methods

    BoxCast(float3, quaternion, float3, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)

    Box cast.

    Declaration
    public readonly bool BoxCast(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, out ColliderCastHit hitInfo, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    ColliderCastHit hitInfo

    [out] Information describing the hit.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.BoxCast(float3, quaternion, float3, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)

    BoxCast(float3, quaternion, float3, float3, Single, CollisionFilter, QueryInteraction)

    Box cast.

    Declaration
    public readonly bool BoxCast(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.BoxCast(float3, quaternion, float3, float3, Single, CollisionFilter, QueryInteraction)

    BoxCastAll(float3, quaternion, float3, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)

    Box cast all.

    Declaration
    public readonly bool BoxCastAll(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    NativeList<ColliderCastHit> outHits

    [in,out] The out hits.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.BoxCastAll(float3, quaternion, float3, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)

    BoxCastCustom<T>(float3, quaternion, float3, float3, Single, ref T, CollisionFilter, QueryInteraction)

    Box cast custom.

    Declaration
    public readonly bool BoxCastCustom<T>(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<ColliderCastHit>
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    T collector

    [in,out] The collector.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.BoxCastCustom<T>(float3, quaternion, float3, float3, Single, ref T, CollisionFilter, QueryInteraction)

    CalculateAabb()

    Calculates the aabb of this aspect in world space.

    Declaration
    public readonly Aabb CalculateAabb()
    Returns
    Type Description
    Aabb

    The calculated aabb in world space.

    Implements
    ICollidable.CalculateAabb()

    CalculateDistance(in ColliderAspect, Single, ref NativeList<DistanceHit>, QueryInteraction)

    Calculates the distance from the input aspect.

    Declaration
    public readonly bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, ref NativeList<DistanceHit> allHits, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    Single maxDistance

    The maximum distance.

    NativeList<DistanceHit> allHits

    [in,out] all hits.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    IAspectQueryable.CalculateDistance(in ColliderAspect, Single, ref NativeList<DistanceHit>, QueryInteraction)

    CalculateDistance(in ColliderAspect, Single, out DistanceHit, QueryInteraction)

    Calculates the distance from the input aspect.

    Declaration
    public readonly bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, out DistanceHit closestHit, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    Single maxDistance

    The maximum distance.

    DistanceHit closestHit

    [out] The closest hit.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    IAspectQueryable.CalculateDistance(in ColliderAspect, Single, out DistanceHit, QueryInteraction)

    CalculateDistance(in ColliderAspect, Single, QueryInteraction)

    Calculates the distance from the input aspect.

    Declaration
    public readonly bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    Single maxDistance

    The maximum distance.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    IAspectQueryable.CalculateDistance(in ColliderAspect, Single, QueryInteraction)

    CalculateDistance(ColliderDistanceInput)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance(ColliderDistanceInput input)
    Parameters
    Type Name Description
    ColliderDistanceInput input

    The input.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CalculateDistance(ColliderDistanceInput)

    CalculateDistance(ColliderDistanceInput, ref NativeList<DistanceHit>)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance(ColliderDistanceInput input, ref NativeList<DistanceHit> allHits)
    Parameters
    Type Name Description
    ColliderDistanceInput input

    The input.

    NativeList<DistanceHit> allHits

    [in,out] all hits.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CalculateDistance(ColliderDistanceInput, ref NativeList<DistanceHit>)

    CalculateDistance(ColliderDistanceInput, out DistanceHit)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance(ColliderDistanceInput input, out DistanceHit closestHit)
    Parameters
    Type Name Description
    ColliderDistanceInput input

    The input.

    DistanceHit closestHit

    [out] The closest hit.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CalculateDistance(ColliderDistanceInput, out DistanceHit)

    CalculateDistance(PointDistanceInput)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance(PointDistanceInput input)
    Parameters
    Type Name Description
    PointDistanceInput input

    The input.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CalculateDistance(PointDistanceInput)

    CalculateDistance(PointDistanceInput, ref NativeList<DistanceHit>)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance(PointDistanceInput input, ref NativeList<DistanceHit> allHits)
    Parameters
    Type Name Description
    PointDistanceInput input

    The input.

    NativeList<DistanceHit> allHits

    [in,out] all hits.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CalculateDistance(PointDistanceInput, ref NativeList<DistanceHit>)

    CalculateDistance(PointDistanceInput, out DistanceHit)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance(PointDistanceInput input, out DistanceHit closestHit)
    Parameters
    Type Name Description
    PointDistanceInput input

    The input.

    DistanceHit closestHit

    [out] The closest hit.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CalculateDistance(PointDistanceInput, out DistanceHit)

    CalculateDistance<T>(in ColliderAspect, Single, ref T, QueryInteraction)

    Calculates the distance from the input aspect.

    Declaration
    public readonly bool CalculateDistance<T>(in ColliderAspect colliderAspect, float maxDistance, ref T collector, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<DistanceHit>
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    Single maxDistance

    The maximum distance.

    T collector

    [in,out] The collector.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    IAspectQueryable.CalculateDistance<T>(in ColliderAspect, Single, ref T, QueryInteraction)

    CalculateDistance<T>(ColliderDistanceInput, ref T)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance<T>(ColliderDistanceInput input, ref T collector)
        where T : struct, ICollector<DistanceHit>
    Parameters
    Type Name Description
    ColliderDistanceInput input

    The input.

    T collector

    [in,out] The collector.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.CalculateDistance<T>(ColliderDistanceInput, ref T)

    CalculateDistance<T>(PointDistanceInput, ref T)

    Calculates the distance.

    Declaration
    public readonly bool CalculateDistance<T>(PointDistanceInput input, ref T collector)
        where T : struct, ICollector<DistanceHit>
    Parameters
    Type Name Description
    PointDistanceInput input

    The input.

    T collector

    [in,out] The collector.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.CalculateDistance<T>(PointDistanceInput, ref T)

    CapsuleCast(float3, float3, Single, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)

    Capsule cast.

    Declaration
    public readonly bool CapsuleCast(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, out ColliderCastHit hitInfo, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    ColliderCastHit hitInfo

    [out] Information describing the hit.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CapsuleCast(float3, float3, Single, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)

    CapsuleCast(float3, float3, Single, float3, Single, CollisionFilter, QueryInteraction)

    Capsule cast.

    Declaration
    public readonly bool CapsuleCast(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CapsuleCast(float3, float3, Single, float3, Single, CollisionFilter, QueryInteraction)

    CapsuleCastAll(float3, float3, Single, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)

    Capsule cast all.

    Declaration
    public readonly bool CapsuleCastAll(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    NativeList<ColliderCastHit> outHits

    [in,out] The out hits.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CapsuleCastAll(float3, float3, Single, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)

    CapsuleCastCustom<T>(float3, float3, Single, float3, Single, ref T, CollisionFilter, QueryInteraction)

    Capsule cast custom.

    Declaration
    public readonly bool CapsuleCastCustom<T>(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<ColliderCastHit>
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    T collector

    [in,out] The collector.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.CapsuleCastCustom<T>(float3, float3, Single, float3, Single, ref T, CollisionFilter, QueryInteraction)

    CastCollider(in ColliderAspect, float3, Single, ref NativeList<ColliderCastHit>, QueryInteraction)

    Cast another collider aspect against this one.

    Declaration
    public readonly bool CastCollider(in ColliderAspect colliderAspect, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> allHits, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    float3 direction

    The direction of the input aspect.

    Single maxDistance

    The maximum distance.

    NativeList<ColliderCastHit> allHits

    [in,out] all hits.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    IAspectQueryable.CastCollider(in ColliderAspect, float3, Single, ref NativeList<ColliderCastHit>, QueryInteraction)

    CastCollider(in ColliderAspect, float3, Single, out ColliderCastHit, QueryInteraction)

    Cast another collider aspect against this one.

    Declaration
    public readonly bool CastCollider(in ColliderAspect colliderAspect, float3 direction, float maxDistance, out ColliderCastHit closestHit, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    float3 direction

    The direction of the input aspect.

    Single maxDistance

    The maximum distance.

    ColliderCastHit closestHit

    [out] The closest hit.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    IAspectQueryable.CastCollider(in ColliderAspect, float3, Single, out ColliderCastHit, QueryInteraction)

    CastCollider(in ColliderAspect, float3, Single, QueryInteraction)

    Cast another collider aspect against this one.

    Declaration
    public readonly bool CastCollider(in ColliderAspect colliderAspect, float3 direction, float maxDistance, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    float3 direction

    The direction of the input aspect.

    Single maxDistance

    The maximum distance.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    IAspectQueryable.CastCollider(in ColliderAspect, float3, Single, QueryInteraction)

    CastCollider(ColliderCastInput)

    Cast collider.

    Declaration
    public readonly bool CastCollider(ColliderCastInput input)
    Parameters
    Type Name Description
    ColliderCastInput input

    The input.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CastCollider(ColliderCastInput)

    CastCollider(ColliderCastInput, ref NativeList<ColliderCastHit>)

    Cast collider.

    Declaration
    public readonly bool CastCollider(ColliderCastInput input, ref NativeList<ColliderCastHit> allHits)
    Parameters
    Type Name Description
    ColliderCastInput input

    The input.

    NativeList<ColliderCastHit> allHits

    [in,out] all hits.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CastCollider(ColliderCastInput, ref NativeList<ColliderCastHit>)

    CastCollider(ColliderCastInput, out ColliderCastHit)

    Cast collider.

    Declaration
    public readonly bool CastCollider(ColliderCastInput input, out ColliderCastHit closestHit)
    Parameters
    Type Name Description
    ColliderCastInput input

    The input.

    ColliderCastHit closestHit

    [out] The closest hit.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CastCollider(ColliderCastInput, out ColliderCastHit)

    CastCollider<T>(in ColliderAspect, float3, Single, ref T, QueryInteraction)

    Cast another collider aspect against this one.

    Declaration
    public readonly bool CastCollider<T>(in ColliderAspect colliderAspect, float3 direction, float maxDistance, ref T collector, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<ColliderCastHit>
    Parameters
    Type Name Description
    ColliderAspect colliderAspect

    The collider aspect.

    float3 direction

    The direction of the input aspect.

    Single maxDistance

    The maximum distance.

    T collector

    [in,out] The collector.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    IAspectQueryable.CastCollider<T>(in ColliderAspect, float3, Single, ref T, QueryInteraction)

    CastCollider<T>(ColliderCastInput, ref T)

    Cast collider.

    Declaration
    public readonly bool CastCollider<T>(ColliderCastInput input, ref T collector)
        where T : struct, ICollector<ColliderCastHit>
    Parameters
    Type Name Description
    ColliderCastInput input

    The input.

    T collector

    [in,out] The collector.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.CastCollider<T>(ColliderCastInput, ref T)

    CastRay(RaycastInput)

    Cast ray.

    Declaration
    public readonly bool CastRay(RaycastInput input)
    Parameters
    Type Name Description
    RaycastInput input

    The input.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CastRay(RaycastInput)

    CastRay(RaycastInput, ref NativeList<RaycastHit>)

    Cast ray.

    Declaration
    public readonly bool CastRay(RaycastInput input, ref NativeList<RaycastHit> allHits)
    Parameters
    Type Name Description
    RaycastInput input

    The input.

    NativeList<RaycastHit> allHits

    [in,out] all hits.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CastRay(RaycastInput, ref NativeList<RaycastHit>)

    CastRay(RaycastInput, out RaycastHit)

    Cast ray.

    Declaration
    public readonly bool CastRay(RaycastInput input, out RaycastHit closestHit)
    Parameters
    Type Name Description
    RaycastInput input

    The input.

    RaycastHit closestHit

    [out] The closest hit.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CastRay(RaycastInput, out RaycastHit)

    CastRay<T>(RaycastInput, ref T)

    Cast ray.

    Declaration
    public readonly bool CastRay<T>(RaycastInput input, ref T collector)
        where T : struct, ICollector<RaycastHit>
    Parameters
    Type Name Description
    RaycastInput input

    The input.

    T collector

    [in,out] The collector.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.CastRay<T>(RaycastInput, ref T)

    CheckBox(float3, quaternion, float3, CollisionFilter, QueryInteraction)

    Check box.

    Declaration
    public readonly bool CheckBox(float3 center, quaternion orientation, float3 halfExtents, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CheckBox(float3, quaternion, float3, CollisionFilter, QueryInteraction)

    CheckCapsule(float3, float3, Single, CollisionFilter, QueryInteraction)

    Check capsule.

    Declaration
    public readonly bool CheckCapsule(float3 point1, float3 point2, float radius, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CheckCapsule(float3, float3, Single, CollisionFilter, QueryInteraction)

    CheckSphere(float3, Single, CollisionFilter, QueryInteraction)

    Checks if a sphere overlaps with this body.

    Declaration
    public readonly bool CheckSphere(float3 position, float radius, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 position

    The position.

    Single radius

    The radius.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.CheckSphere(float3, Single, CollisionFilter, QueryInteraction)

    ConvertChildIndexToColliderKey(Int32)

    Convert child index to collider key.

    Declaration
    public readonly ColliderKey ConvertChildIndexToColliderKey(int childIndex)
    Parameters
    Type Name Description
    Int32 childIndex

    Zero-based index of the child.

    Returns
    Type Description
    ColliderKey

    The child converted index to collider key. If the collider is not a CompoundCollider, returns Empty.

    GetColliderKeyToChildrenMapping(ref NativeHashMap<ColliderKey, ChildCollider>)

    Has effect only if the collider is a CompoundCollider. Fills the passed in map with ColliderKey - ChildCollider pairs of the compound collider.

    Declaration
    public readonly void GetColliderKeyToChildrenMapping(ref NativeHashMap<ColliderKey, ChildCollider> colliderKeyToChildrenMapping)
    Parameters
    Type Name Description
    NativeHashMap<ColliderKey, ChildCollider> colliderKeyToChildrenMapping

    [in,out] The collider key to children mapping.

    GetCollisionFilter()

    Get the collision filter. In case of a CompoundCollider, returns the root filter.

    Declaration
    public readonly CollisionFilter GetCollisionFilter()
    Returns
    Type Description
    CollisionFilter

    The collision filter.

    GetCollisionFilter(ColliderKey)

    Gets the collision filter specified by the collider key. The key is only read in case the collider is CompoundCollider, otherwise it is ignored and will behave as GetCollisionFilter().

    Declaration
    public readonly CollisionFilter GetCollisionFilter(ColliderKey colliderKey)
    Parameters
    Type Name Description
    ColliderKey colliderKey

    The collider key.

    Returns
    Type Description
    CollisionFilter

    The collision filter.

    GetCollisionResponse()

    Gets the collision response. In case of a CompoundCollider, this behaves as GetCollisionResponse(ColliderKey) with ColliderKey.Zero passed in.

    Declaration
    public readonly CollisionResponsePolicy GetCollisionResponse()
    Returns
    Type Description
    CollisionResponsePolicy

    The collision response.

    GetCollisionResponse(ColliderKey)

    Gets collision response of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as GetCollisionResponse() . In case of CompoundCollider if the colider key is empty, it will return the collision response of the first child.

    Declaration
    public readonly CollisionResponsePolicy GetCollisionResponse(ColliderKey colliderKey)
    Parameters
    Type Name Description
    ColliderKey colliderKey

    The collider key.

    Returns
    Type Description
    CollisionResponsePolicy

    The collision response.

    GetFriction()

    Gets the friction. In case of a CompoundCollider, this behaves as GetFriction(ColliderKey) with ColliderKey.Zero passed in.

    Declaration
    public readonly float GetFriction()
    Returns
    Type Description
    Single

    The friction.

    GetFriction(ColliderKey)

    Gets the friction of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as GetFriction() . In case of CompoundCollider if the colider key is empty, it will return the friction of the first child.

    Declaration
    public readonly float GetFriction(ColliderKey colliderKey)
    Parameters
    Type Name Description
    ColliderKey colliderKey

    The collider key.

    Returns
    Type Description
    Single

    The friction.

    GetNumberOfChildren()

    Gets the children of this collider aspect.

    Declaration
    public readonly int GetNumberOfChildren()
    Returns
    Type Description
    Int32

    The number of children. If the collider is not a CompoundCollider, returns 0.

    GetRestitution()

    Gets the restitution. In case of a CompoundCollider, this behaves as GetRestitution(ColliderKey) with ColliderKey.Zero passed in.

    Declaration
    public readonly float GetRestitution()
    Returns
    Type Description
    Single

    The restitution.

    GetRestitution(ColliderKey)

    Gets a restitution of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as GetRestitution() . In case of CompoundCollider if the colider key is empty, it will return the restitution of the first child.

    Declaration
    public readonly float GetRestitution(ColliderKey colliderKey)
    Parameters
    Type Name Description
    ColliderKey colliderKey

    The collider key.

    Returns
    Type Description
    Single

    The restitution.

    OverlapBox(float3, quaternion, float3, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

    Overlap box.

    Declaration
    public readonly bool OverlapBox(float3 center, quaternion orientation, float3 halfExtents, ref NativeList<DistanceHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    NativeList<DistanceHit> outHits

    [in,out] The out hits.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.OverlapBox(float3, quaternion, float3, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

    OverlapBoxCustom<T>(float3, quaternion, float3, ref T, CollisionFilter, QueryInteraction)

    Overlap box custom.

    Declaration
    public readonly bool OverlapBoxCustom<T>(float3 center, quaternion orientation, float3 halfExtents, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<DistanceHit>
    Parameters
    Type Name Description
    float3 center

    The center.

    quaternion orientation

    The orientation.

    float3 halfExtents

    Half extents of the box.

    T collector

    [in,out] The collector.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.OverlapBoxCustom<T>(float3, quaternion, float3, ref T, CollisionFilter, QueryInteraction)

    OverlapCapsule(float3, float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

    Overlap capsule.

    Declaration
    public readonly bool OverlapCapsule(float3 point1, float3 point2, float radius, ref NativeList<DistanceHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    NativeList<DistanceHit> outHits

    [in,out] The out hits.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.OverlapCapsule(float3, float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

    OverlapCapsuleCustom<T>(float3, float3, Single, ref T, CollisionFilter, QueryInteraction)

    Overlap capsule custom.

    Declaration
    public readonly bool OverlapCapsuleCustom<T>(float3 point1, float3 point2, float radius, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<DistanceHit>
    Parameters
    Type Name Description
    float3 point1

    The first point in capsule definition.

    float3 point2

    The second point in capsule definition.

    Single radius

    The radius.

    T collector

    [in,out] The collector.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.OverlapCapsuleCustom<T>(float3, float3, Single, ref T, CollisionFilter, QueryInteraction)

    OverlapSphere(float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

    Overlap sphere.

    Declaration
    public readonly bool OverlapSphere(float3 position, float radius, ref NativeList<DistanceHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 position

    The position.

    Single radius

    The radius.

    NativeList<DistanceHit> outHits

    [in,out] The out hits.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.OverlapSphere(float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

    OverlapSphereCustom<T>(float3, Single, ref T, CollisionFilter, QueryInteraction)

    Overlap sphere custom.

    Declaration
    public readonly bool OverlapSphereCustom<T>(float3 position, float radius, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<DistanceHit>
    Parameters
    Type Name Description
    float3 position

    The position.

    Single radius

    The radius.

    T collector

    [in,out] The collector.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.OverlapSphereCustom<T>(float3, Single, ref T, CollisionFilter, QueryInteraction)

    SetCollisionFilter(CollisionFilter)

    Sets the collision filter. In case of a CompoundCollider sets the root filter.

    Declaration
    public readonly void SetCollisionFilter(CollisionFilter filter)
    Parameters
    Type Name Description
    CollisionFilter filter

    Specifies the filter.

    SetCollisionFilter(CollisionFilter, ColliderKey)

    Sets the collision filter of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetCollisionFilter(CollisionFilter)

    Declaration
    public readonly void SetCollisionFilter(CollisionFilter filter, ColliderKey colliderKey)
    Parameters
    Type Name Description
    CollisionFilter filter

    Specifies the filter.

    ColliderKey colliderKey

    The collider key.

    SetCollisionResponse(CollisionResponsePolicy)

    Sets collision response. In case of a CompoundCollider, this behaves as SetCollisionResponse(CollisionResponsePolicy, ColliderKey) with ColliderKey.Zero passed in.

    Declaration
    public readonly void SetCollisionResponse(CollisionResponsePolicy collisionResponse)
    Parameters
    Type Name Description
    CollisionResponsePolicy collisionResponse

    The collision response.

    SetCollisionResponse(CollisionResponsePolicy, ColliderKey)

    Sets collision response of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetCollisionResponse(CollisionResponsePolicy) . In case of CompoundCollider if the collider key is empty, it will set the collision response of the all children.

    Declaration
    public readonly void SetCollisionResponse(CollisionResponsePolicy collisionResponse, ColliderKey colliderKey)
    Parameters
    Type Name Description
    CollisionResponsePolicy collisionResponse

    The collision response.

    ColliderKey colliderKey

    The collider key.

    SetFriction(Single)

    Sets the friction. In case of a CompoundCollider, this behaves as SetFriction(Single, ColliderKey) with ColliderKey.Zero passed in.

    Declaration
    public readonly void SetFriction(float friction)
    Parameters
    Type Name Description
    Single friction

    The friction.

    SetFriction(Single, ColliderKey)

    Sets the friction of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetFriction(Single) . In case of CompoundCollider if the collider key is empty, it will set the friction of the all children.

    Declaration
    public readonly void SetFriction(float friction, ColliderKey colliderKey)
    Parameters
    Type Name Description
    Single friction

    The friction.

    ColliderKey colliderKey

    The collider key.

    SetRestitution(Single)

    Sets the restitution. In case of a CompoundCollider, this behaves as SetRestitution(Single, ColliderKey) with ColliderKey.Zero passed in.

    Declaration
    public readonly void SetRestitution(float restitution)
    Parameters
    Type Name Description
    Single restitution

    The restitution.

    SetRestitution(Single, ColliderKey)

    Sets the restitution of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetRestitution(Single) . In case of CompoundCollider if the collider key is empty, it will set the restitution of the all children.

    Declaration
    public readonly void SetRestitution(float restitution, ColliderKey colliderKey)
    Parameters
    Type Name Description
    Single restitution

    The restitution.

    ColliderKey colliderKey

    The collider key.

    SphereCast(float3, Single, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)

    Sphere cast.

    Declaration
    public readonly bool SphereCast(float3 origin, float radius, float3 direction, float maxDistance, out ColliderCastHit hitInfo, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 origin

    The origin.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    ColliderCastHit hitInfo

    [out] Information describing the hit.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.SphereCast(float3, Single, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)

    SphereCast(float3, Single, float3, Single, CollisionFilter, QueryInteraction)

    Sphere cast.

    Declaration
    public readonly bool SphereCast(float3 origin, float radius, float3 direction, float maxDistance, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 origin

    The origin.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.SphereCast(float3, Single, float3, Single, CollisionFilter, QueryInteraction)

    SphereCastAll(float3, Single, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)

    Sphere cast all.

    Declaration
    public readonly bool SphereCastAll(float3 origin, float radius, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
    Parameters
    Type Name Description
    float3 origin

    The origin.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    NativeList<ColliderCastHit> outHits

    [in,out] The out hits.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Implements
    ICollidable.SphereCastAll(float3, Single, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)

    SphereCastCustom<T>(float3, Single, float3, Single, ref T, CollisionFilter, QueryInteraction)

    Sphere cast custom.

    Declaration
    public readonly bool SphereCastCustom<T>(float3 origin, float radius, float3 direction, float maxDistance, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
        where T : struct, ICollector<ColliderCastHit>
    Parameters
    Type Name Description
    float3 origin

    The origin.

    Single radius

    The radius.

    float3 direction

    The direction.

    Single maxDistance

    The maximum distance.

    T collector

    [in,out] The collector.

    CollisionFilter filter

    Specifies the filter.

    QueryInteraction queryInteraction

    (Optional) The query interaction.

    Returns
    Type Description
    Boolean

    True if there is a hit, false otherwise.

    Type Parameters
    Name Description
    T

    Generic type parameter.

    Implements
    ICollidable.SphereCastCustom<T>(float3, Single, float3, Single, ref T, CollisionFilter, QueryInteraction)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023