# PhysicsQuery.WorldCastResult

> The results from performing any Cast query against the PhysicsWorld.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule
* **Implements:** [IEquatable\<WorldCastResult>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public readonly struct PhysicsQuery.WorldCastResult : IEquatable<PhysicsQuery.WorldCastResult>
```

## Remarks

Use [PhysicsWorld.CastGeometry](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld/castgeometry.md) or [PhysicsWorld.CastRay](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld/castray.md) to check whether a shape or ray will intersect other shapes as it moves through the world, for example to predict a collision before it happens.

Additional Resources: [PhysicsWorld.CastGeometry](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld/castgeometry.md), [PhysicsWorld.TestOverlapAABB](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld/testoverlapaabb.md), [PhysicsAABB](/engine/6000.7/script-reference/unity/u2d/physics/physicsaabb.md)

## Examples

```csharp
// Check whether a small falling circle will collide with objects underneath it.
using UnityEngine;
using Unity.U2D.Physics;
using Unity.Collections;

public class CastGeometryExample : MonoBehaviour
{
    private PhysicsWorld world;

    void Start()
    {
        world = PhysicsWorld.defaultWorld;

        // Create a small falling circle.
        CircleGeometry object1Geometry = CircleGeometry.Create(0.5f, new Vector2(0.5f, 8f));
        PhysicsBody object1 = world.CreateBody(new PhysicsBodyDefinition
        {
            position = object1Geometry.center,
            type = PhysicsBody.BodyType.Dynamic
        });
        object1.CreateShape(object1Geometry);

        // Set the translation and filter for the cast.
        Vector2 translation = new Vector2(0, -10f);
        PhysicsQuery.QueryFilter filter = new PhysicsQuery.QueryFilter();

        // Cast the circle geometry through the world.
        // Use "using" to automatically dispose of the NativeArray once it goes out of scope.
        using NativeArray<PhysicsQuery.WorldCastResult> results = world.CastGeometry(object1Geometry, translation, filter, PhysicsQuery.WorldCastMode.Closest, Allocator.Temp);

        if (results.Length > 0)
        {
            Debug.Log("Collision will occur!");
        }
    }
}
```

## Properties

| Property                                                                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [fraction](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/fraction.md) | The fraction of the query cast distance the shape would move to the point of detection, in the range \[0, 1].                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [isValid](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/isvalid.md)   | Check if the result is valid.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [normal](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/normal.md)     | The surface normal at the point of contact. In all non-overlapped cases, this will be a unit-normal. If there was an initial overlap, the normal will be zero (degenerate) along with the [\_fraction](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/fraction.md) being zero and [\_point](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/point.md) being an arbitrary point in the overlapped region. See [\_point](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/point.md). |
| [point](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/point.md)       | The point of contact.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [shape](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresult/shape.md)       | The shape that was detected by the cast.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

## Structs

| Struct                                                                                                                                                 | Description                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------- |
| [PhysicsQuery.WorldCastResult.SortAscendingOrder](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/worldcastresultsortascendingorder.md) | Ascending distance sort comparer. |
