Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


OverlapCapsule(Vector3, Vector3, float, int, QueryTriggerInteraction)

Check the given capsule against the physics world and return all overlapping colliders.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
public static Collider[] OverlapCapsule(Vector3 point0, Vector3 point1, float radius, int layerMask, QueryTriggerInteraction queryTriggerInteraction)

Parameters

point0

The center of the sphere at the
start
of the capsule.

point1

The center of the sphere at the
end
of the capsule.

radius

The radius of the capsule.

layerMask

A Layer mask that is used to selectively filter which colliders are considered when casting a capsule.

queryTriggerInteraction

Specifies whether this query should hit Triggers.

Returns

Type

Description

Collider[]Colliders touching or inside the capsule.