# PhysicsQuery.WorldCastMode

> Controls what results are returned from a cast query against the PhysicsWorld.

## Definition

* **Type:** Enum
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public enum PhysicsQuery.WorldCastMode
```

## Examples

```csharp
// Cast a circle and return every hit, sorted by ascending distance.
using UnityEngine;
using Unity.Collections;
using Unity.U2D.Physics;

public class WorldCastModeExample : MonoBehaviour
{
    void Start()
    {
        PhysicsWorld world = PhysicsWorld.defaultWorld;
        CircleGeometry geometry = new CircleGeometry { radius = 0.5f };
        Vector2 translation = new Vector2(0f, -10f);
        PhysicsQuery.QueryFilter filter = new PhysicsQuery.QueryFilter();

        using NativeArray<PhysicsQuery.WorldCastResult> results = world.CastGeometry(geometry, translation, filter, PhysicsQuery.WorldCastMode.AllSorted, Allocator.Temp);
    }
}
```

## Fields

| Value                                                                                                  | Description                                                              |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| [All](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastmode/all.md)             | Return all the hits.                                                     |
| [AllSorted](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastmode/allsorted.md) | Return all the hits but also sort by ascending distance (closest first). |
| [Closest](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastmode/closest.md)     | Return only the closest hit.                                             |
