OverlapSphere(Vector3, float, Collider[], int, QueryTriggerInteraction)
Computes and stores colliders touching or inside the sphere into the provided buffer.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
public int OverlapSphere(Vector3 position, float radius, Collider[] results, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
Parameters
Center of the sphere.
Radius of the sphere.
The buffer to store the results into.
A Layer mask that is used to selectively ignore colliders when casting a ray.
Specifies whether this query should hit Triggers.
Returns
Type | Description |
|---|---|
| int | The number of colliders detected that overlap with the sphere and were stored in the |
Remarks
Additional Resources: Physics.OverlapSphereNonAlloc.