Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CapsuleCastNonAlloc(Vector3, Vector3, float, Vector3, RaycastHit[], float, int, QueryTriggerInteraction)

Casts a capsule against all colliders in the Scene and returns detailed information on what was hit into the buffer.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
public static int CapsuleCastNonAlloc(Vector3 point1, Vector3 point2, float radius, Vector3 direction, RaycastHit[] results, float maxDistance, int layerMask, QueryTriggerInteraction queryTriggerInteraction)

Parameters

point1

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

point2

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

radius

The radius of the capsule.

direction

The direction into which to sweep the capsule.

The buffer to store the hits into.

maxDistance

The max length of the sweep.

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

intThe amount of hits stored into the buffer.

Remarks

Like Physics.CapsuleCastAll, but generates no garbage.