public static Vector3 ClosestPoint (Vector3 point, Collider collider, Vector3 position, Quaternion rotation);

Parameters

pointLocation you want to find the closest point to.
colliderThe collider that you find the closest point on.
positionThe position of the collider.
rotationThe rotation of the collider.

Returns

Vector3 The point on the collider that is closest to the specified location.

Description

Returns a point on the given collider that is closest to the specified location.

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.

See Also: ClosestPoint.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961