> For the complete documentation index, see [llms.txt](https://renownedgames.gitbook.io/ai-tree/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://renownedgames.gitbook.io/ai-tree/nodes/tasks/physics2d/sphere-cast-2d.md).

# Sphere Cast 2D

Node description and basic instructions

### Description

Casts a circle against Colliders in the Scene, returning the first Collider to contact with it.

A Circle Cast is conceptually like dragging a circle through the Scene in a particular direction. Any object making contact with the circle can be detected and reported.

{% hint style="info" %}
This function returns a RaycastHit2D object with a reference to the Collider that is hit by the box (the Collider property of the result will be NULL if nothing was hit).

The returned RaycastHit2D returns both the point and normal of the contact where the circle would touch the Collider. It also returns the centroid where the circle would be positioned for it to contact at that point.
{% endhint %}

**To create it**, right-click on free space in AI Tree inspector and select <mark style="color:purple;">Create Node/Tasks/Physics2D/Sphere Cast 2D.</mark>

This task node has a number of fields, that are highlighted in picture below.

<figure><img src="https://2203000093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGOxTM7Aj9oiVaIINrEkE%2Fuploads%2FIRbUrSOhSGYetPjrGgZl%2FPhys10.png?alt=media&amp;token=c253b99c-d3e5-46bd-bc1a-967ce4dc191a" alt=""><figcaption></figcaption></figure>

### Fields

| Name              | Description                                                        |
| ----------------- | ------------------------------------------------------------------ |
| Node Name         | Name of node                                                       |
| Ignore Abort Self | Whether node ignores abort self or not                             |
| Origin            | Origin of the Sphere Cast 2D                                       |
| Direction         | Direction of the Sphere Cast 2D                                    |
| Radius            | Radius of the sphere                                               |
| Max Distance      | Max length of the cast (by default: *infinity*)                    |
| Culling Layer     | Used to selectively ignore colliders when casting a Sphere Cast 2D |

### Message

| Name     | Description                                                       |
| -------- | ----------------------------------------------------------------- |
| Message  | Value of message                                                  |
| Argument | Argument of message in [Blackboard](/ai-tree/basic/blackboard.md) |
