# ClosestPointOnBounds(Vector3)

> The closest point to the bounding box of the attached colliders.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.PhysicsModule

```csharp
public Vector3 ClosestPointOnBounds(Vector3 position)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)):&#x20;

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Vector3](/engine/6000.0/script-reference/unityengine/vector3.md) |             |

### Examples

```csharp
// Subtract damage from a character's hit points when an
// explosion occurs.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public float hitPoints = 10.0F;
    public Rigidbody rb;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    void ApplyDamage(Vector3 explosionPos, float radius)
    {
        Vector3 closestPoint = rb.ClosestPointOnBounds(explosionPos);
        float distance = Vector3.Distance(closestPoint, explosionPos);
        float damage = 1.0F - Mathf.Clamp01(distance / radius);
        damage *= 10;
        hitPoints -= damage;
    }
}
```
