ドキュメント

Unity Engine

Unity Engine

ClosestPoint(Vector3, Collider, Vector3, Quaternion)

Returns a point on the given collider that is closest to the specified location.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
public static Vector3 ClosestPoint(Vector3 point, Collider collider, Vector3 position, Quaternion rotation)

Parameters

point

Location you want to find the closest point to.

collider

The collider that you find the closest point on.

position

The position of the collider.

rotation

The rotation of the collider.

Returns

Type

Description

Vector3The point on the collider that is closest to the specified location.

Remarks

Note that in case the specified location is inside the collider, or exactly on the boundary of it, the input location is returned instead.
The collider can only be BoxCollider, SphereCollider, CapsuleCollider or a convex MeshCollider.
Additional Resources: Collider.ClosestPoint.