UnityEngine.Collider.ClosestPointOnBounds C# (CSharp) Method

ClosestPointOnBounds() public method

The closest point to the bounding box of the attached collider.

public ClosestPointOnBounds ( Vector3 position ) : Vector3
position Vector3
return Vector3
        public Vector3 ClosestPointOnBounds(Vector3 position)
        {
            Vector3 vector;
            INTERNAL_CALL_ClosestPointOnBounds(this, ref position, out vector);
            return vector;
        }

Usage Example

 void OnTriggerEnter(Collider other)
 {
     if(attack!=null){
         if(other.tag.Equals("Enemy")){
             attack.GetComponent<Attack>().enemyCollisionEnter(other.gameObject,other.ClosestPointOnBounds(transform.position));
         }else{
             attack.GetComponent<Attack>().otherCollisionEnter(other.gameObject,other.ClosestPointOnBounds(transform.position));
         }
     }
     if (debug != null) {
         debug.SetActive (true);
         wasEnabled = false;
     }
 }
All Usage Examples Of UnityEngine.Collider::ClosestPointOnBounds