ドキュメント

Unity Engine

Unity Engine

OverlapSphere(Vector3, float, Collider[], int, QueryTriggerInteraction)

Computes and stores colliders touching or inside the sphere into the provided buffer.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
public int OverlapSphere(Vector3 position, float radius, Collider[] results, int layerMask, QueryTriggerInteraction queryTriggerInteraction)

Parameters

position

Center of the sphere.

radius

Radius of the sphere.

results

The buffer to store the results into.

layerMask

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

queryTriggerInteraction

Specifies whether this query should hit Triggers.

Returns

Type

Description

intThe number of colliders detected that overlap with the sphere and were stored in the
results
array. The return value cannot exceed the size of the
results
array.

Remarks

Additional Resources: Physics.OverlapSphereNonAlloc.