Struct Collider
Base struct common to all colliders. Dispatches the interface methods to appropriate implementations for the collider type.
Inherited Members
Namespace: Unity.Physics
Syntax
public struct Collider : ICompositeCollider, ICollider, ICollidable
Properties
CollisionType
Gets the type of the collision.
Declaration
public readonly CollisionType CollisionType { get; }
Property Value
Type | Description |
---|---|
CollisionType | The type of the collision. |
Implements
MassProperties
Gets the mass properties.
Declaration
public readonly MassProperties MassProperties { get; }
Property Value
Type | Description |
---|---|
MassProperties | The mass properties. |
Implements
MemorySize
Gets the memory size.
Declaration
public readonly int MemorySize { get; }
Property Value
Type | Description |
---|---|
Int32 | The size of the memory. |
Implements
NumColliderKeyBits
Gets the number of collider key bits.
Declaration
public readonly uint NumColliderKeyBits { get; }
Property Value
Type | Description |
---|---|
UInt32 | The total number of collider key bits. |
TotalNumColliderKeyBits
Gets the total number of number collider key bits.
Declaration
public readonly uint TotalNumColliderKeyBits { get; }
Property Value
Type | Description |
---|---|
UInt32 | The total number of number collider key bits. |
Type
Gets the collider type.
Declaration
public readonly ColliderType Type { get; }
Property Value
Type | Description |
---|---|
ColliderType | Collider type. |
Implements
Methods
BoxCast(float3, quaternion, float3, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)
Box cast.
Declaration
public 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
BoxCast(float3, quaternion, float3, float3, Single, CollisionFilter, QueryInteraction)
Box cast.
Declaration
public 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
BoxCastAll(float3, quaternion, float3, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)
Box cast all.
Declaration
public 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
BoxCastCustom<T>(float3, quaternion, float3, float3, Single, ref T, CollisionFilter, QueryInteraction)
Box cast custom.
Declaration
public 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
CalculateAabb()
Calculate a bounding box around this collider.
Declaration
public Aabb CalculateAabb()
Returns
Type | Description |
---|---|
Aabb | The calculated aabb. |
Implements
CalculateAabb(RigidTransform, Single)
Calculate a bounding box around this collider, at the given transform.
Declaration
public Aabb CalculateAabb(RigidTransform transform, float uniformScale = 1F)
Parameters
Type | Name | Description |
---|---|---|
RigidTransform | transform | The transform. |
Single | uniformScale | (Optional) The uniform scale. |
Returns
Type | Description |
---|---|
Aabb | The calculated aabb. |
CalculateDistance(ColliderDistanceInput)
Calculate the distance from another collider to this one.
Declaration
public 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
CalculateDistance(ColliderDistanceInput, ref NativeList<DistanceHit>)
Calculates the distance.
Declaration
public 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
CalculateDistance(ColliderDistanceInput, out DistanceHit)
Calculates the distance.
Declaration
public 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
CalculateDistance(PointDistanceInput)
Calculate the distance from a point to this collider.
Declaration
public 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
CalculateDistance(PointDistanceInput, ref NativeList<DistanceHit>)
Calculates the distance.
Declaration
public 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
CalculateDistance(PointDistanceInput, out DistanceHit)
Calculates the distance.
Declaration
public 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
CalculateDistance<T>(ColliderDistanceInput, ref T)
Calculates the distance.
Declaration
public 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
CalculateDistance<T>(PointDistanceInput, ref T)
Calculates the distance.
Declaration
public 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
CapsuleCast(float3, float3, Single, float3, Single, out ColliderCastHit, CollisionFilter, QueryInteraction)
Capsule cast.
Declaration
public 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
CapsuleCast(float3, float3, Single, float3, Single, CollisionFilter, QueryInteraction)
Capsule cast.
Declaration
public 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
CapsuleCastAll(float3, float3, Single, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)
Capsule cast all.
Declaration
public 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
CapsuleCastCustom<T>(float3, float3, Single, float3, Single, ref T, CollisionFilter, QueryInteraction)
Capsule cast custom.
Declaration
public 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
CastCollider(ColliderCastInput)
Cast another collider against this one.
Declaration
public 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
CastCollider(ColliderCastInput, ref NativeList<ColliderCastHit>)
Cast collider.
Declaration
public 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
CastCollider(ColliderCastInput, out ColliderCastHit)
Cast collider.
Declaration
public 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
CastCollider<T>(ColliderCastInput, ref T)
Cast collider.
Declaration
public 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
CastRay(RaycastInput)
Cast a ray against this collider.
Declaration
public 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
CastRay(RaycastInput, ref NativeList<RaycastHit>)
Cast ray.
Declaration
public 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
CastRay(RaycastInput, out RaycastHit)
Cast ray.
Declaration
public 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
CastRay<T>(RaycastInput, ref T)
Cast ray.
Declaration
public 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
CheckBox(float3, quaternion, float3, CollisionFilter, QueryInteraction)
Check box.
Declaration
public 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
CheckCapsule(float3, float3, Single, CollisionFilter, QueryInteraction)
Check capsule.
Declaration
public 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
CheckSphere(float3, Single, CollisionFilter, QueryInteraction)
Checks if a sphere overlaps this collider.
Declaration
public 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
Clone()
This function clones the Collider and wraps it in a BlobAssetReference. The caller is
responsible for appropriately calling Dispose
on the result.
Declaration
public BlobAssetReference<Collider> Clone()
Returns
Type | Description |
---|---|
BlobAssetReference<Collider> | A clone of the Collider wrapped in a BlobAssetReference. |
GetChild(ref ColliderKey, out ChildCollider)
Gets a child of this collider.
Declaration
public bool GetChild(ref ColliderKey key, out ChildCollider child)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | key | [in,out] The key that identifies the child. Gets modified by removing the bits associated with the child collider. |
ChildCollider | child | [out] The child. |
Returns
Type | Description |
---|---|
Boolean | True if there is a child with the specified key, false otherwise. |
GetCollisionFilter()
Get the collision filter. In case of a CompoundCollider, returns the root filter.
Declaration
public CollisionFilter GetCollisionFilter()
Returns
Type | Description |
---|---|
CollisionFilter | The collision filter. |
Implements
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 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 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 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 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 float GetFriction(ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | colliderKey | The collider key. |
Returns
Type | Description |
---|---|
Single | The friction. |
GetLeaf(ColliderKey, out ChildCollider)
Gets a leaf collider.
Declaration
public bool GetLeaf(ColliderKey key, out ChildCollider leaf)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | key | The key representing the leaf collider. |
ChildCollider | leaf | [out] The leaf. |
Returns
Type | Description |
---|---|
Boolean | True if a leaf with the specified key exists, otherwise false. |
GetLeafCollider(out ChildCollider, Collider*, ColliderKey, RigidTransform, Single)
Get a leaf of a collider hierarchy. Return false if the key is not valid for the collider.
Declaration
public static bool GetLeafCollider(out ChildCollider leaf, Collider*root, ColliderKey key, RigidTransform rootTransform, float rootUniformScale = 1F)
Parameters
Type | Name | Description |
---|---|---|
ChildCollider | leaf | [out] The leaf collider in world space. |
Collider* | root | [in,out] If non-null, the root collider. |
ColliderKey | key | The key identifying the leaf collider. |
RigidTransform | rootTransform | The root transform in world space. |
Single | rootUniformScale | (Optional) The root uniform scale. |
Returns
Type | Description |
---|---|
Boolean | True if there is a leaf with the specified collider key, false otherwise. |
GetLeaves<T>(ref T)
Gets the leaf colliders of this collider .
Declaration
public void GetLeaves<T>([NoAlias] ref T collector)
where T : struct, ILeafColliderCollector
Parameters
Type | Name | Description |
---|---|---|
T | collector | [in,out] The collector. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
GetRestitution()
Gets the restitution. In case of a CompoundCollider, this behaves as GetRestitution(ColliderKey) with ColliderKey.Zero passed in
Declaration
public 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 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 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
OverlapBoxCustom<T>(float3, quaternion, float3, ref T, CollisionFilter, QueryInteraction)
Overlap box custom.
Declaration
public 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
OverlapCapsule(float3, float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)
Overlap capsule.
Declaration
public 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
OverlapCapsuleCustom<T>(float3, float3, Single, ref T, CollisionFilter, QueryInteraction)
Overlap capsule custom.
Declaration
public 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
OverlapSphere(float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)
Overlap sphere.
Declaration
public 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
OverlapSphereCustom<T>(float3, Single, ref T, CollisionFilter, QueryInteraction)
Overlap sphere custom.
Declaration
public 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
SetCollisionFilter(CollisionFilter)
Sets the collision filter. In case of a CompoundCollider sets the root filter.
Declaration
public void SetCollisionFilter(CollisionFilter filter)
Parameters
Type | Name | Description |
---|---|---|
CollisionFilter | filter | Specifies the filter. |
Implements
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 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 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 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 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 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 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 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 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
SphereCast(float3, Single, float3, Single, CollisionFilter, QueryInteraction)
Sphere cast.
Declaration
public 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
SphereCastAll(float3, Single, float3, Single, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)
Sphere cast all.
Declaration
public 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
SphereCastCustom<T>(float3, Single, float3, Single, ref T, CollisionFilter, QueryInteraction)
Sphere cast custom.
Declaration
public 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. |