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.

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.

To create it, right-click on free space in AI Tree inspector and select Create Node/Tasks/Physics2D/Sphere Cast 2D.

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

Fields

NameDescription

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

NameDescription

Message

Value of message

Argument

Argument of message in Blackboard

Last updated