标签:
private BoxCollider mCollider; // Use this for initialization void Start () { mCollider = GetComponent<BoxCollider> (); Bounds bounds = mCollider.bounds; Vector3 boundPoint1 = bounds.min; Vector3 boundPoint2 = bounds.max; Vector3 boundPoint3 = new Vector3 (boundPoint1.x, boundPoint1.y, boundPoint2.z); Vector3 boundPoint4 = new Vector3 (boundPoint1.x, boundPoint2.y, boundPoint1.z); Vector3 boundPoint5 = new Vector3 (boundPoint2.x, boundPoint1.y, boundPoint1.z); Vector3 boundPoint6 = new Vector3 (boundPoint1.x, boundPoint2.y, boundPoint2.z); Vector3 boundPoint7 = new Vector3 (boundPoint2.x, boundPoint1.y, boundPoint2.z); Vector3 boundPoint8 = new Vector3 (boundPoint2.x, boundPoint2.y, boundPoint1.z); // rectangular cuboid // top of rectangular cuboid (6-2-8-4) Debug.DrawLine (boundPoint6, boundPoint2, Color.green, int.MaxValue); Debug.DrawLine (boundPoint2, boundPoint8, Color.green, int.MaxValue); Debug.DrawLine (boundPoint8, boundPoint4, Color.green, int.MaxValue); Debug.DrawLine (boundPoint4, boundPoint6, Color.green, int.MaxValue); // bottom of rectangular cuboid (3-7-5-1) Debug.DrawLine (boundPoint3, boundPoint7, Color.red, int.MaxValue); Debug.DrawLine (boundPoint7, boundPoint5, Color.red, int.MaxValue); Debug.DrawLine (boundPoint5, boundPoint1, Color.red, int.MaxValue); Debug.DrawLine (boundPoint1, boundPoint3, Color.red, int.MaxValue); // legs (6-3, 2-7, 8-5, 4-1) Debug.DrawLine (boundPoint6, boundPoint3, Color.yellow, int.MaxValue); Debug.DrawLine (boundPoint2, boundPoint7, Color.yellow, int.MaxValue); Debug.DrawLine (boundPoint8, boundPoint5, Color.yellow, int.MaxValue); Debug.DrawLine (boundPoint4, boundPoint1, Color.yellow, int.MaxValue); }
标签:
原文地址:http://www.cnblogs.com/eran/p/4392349.html