Capsule Cast 2D

Node description and basic instructions

Description

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

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

This function returns a RaycastHit2D object with a reference to the Collider that is hit by the capsule (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 capsule would touch the Collider. It also returns the centroid where the capsule 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/Capsule 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

Point in 2D space where the capsule originates

Direction

Vector representing the direction to cast the capsule

Size

Size of the capsule

Capsule Direction

Direction of the capsule

Max Distance

Max length of the cast (by default: infinity)

Culling Layer

Used to selectively ignore colliders when casting a Capsule Cast 2D

Message

NameDescription

Message

Value of message

Argument

Argument of message in Blackboard

Last updated