# CheckSphere(Vector3, float, int, QueryTriggerInteraction)

> Returns true if there are any colliders overlapping the sphere defined by position and radius in world coordinates.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.5/script-reference/unityengine.md)
* **Assembly:** UnityEngine.PhysicsModule

```csharp
public static bool CheckSphere(Vector3 position, float radius, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
```

### Parameters

**** (\[Vector3]\(/engine/6000.5/script-reference/unityengine/vector3)): Center of the sphere.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Radius of the sphere.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): A [Layer mask](/engine/6000.5/manual/working-with-gameobjects/layers.md) that is used to selectively filter which colliders are considered when casting a sphere.**** (\[QueryTriggerInteraction]\(/engine/6000.5/script-reference/unityengine/querytriggerinteraction)): Specifies whether this query should hit Triggers.

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public float sphereRadius;
    AudioSource audioSource;

    void Start()
    {
        audioSource = GetComponent<AudioSource>();
    }

    void WarningNoise()
    {
        // Play a noise if an object is within the sphere's radius.
        if (Physics.CheckSphere(transform.position, sphereRadius))
        {
            audioSource.Play();
        }
    }
}
```
