private void OnDrawGizmos() { if (p1 == null) { return; } Vector3 _size = (p2.position - p1.position); Vector3 _center = p1.position + _size / 2f; _160_UnityEngineTest.Bounds_.Bounds _bounds = new _160_UnityEngineTest.Bounds_.Bounds(_center, _size); string _str = ""; Gizmos.color = Color.red; _str += "1>>" + _bounds.center + ":" + _bounds.extents; Gizmos.DrawWireCube(_bounds.center, _bounds.extents * 2f); Gizmos.color = Color.green; _bounds.Expand(2f * skinWidth); _str += "\n2>>" + _bounds.center + ":" + _bounds.extents; //DrawWireCube(_bounds.center, _bounds.extents); Gizmos.DrawWireCube(_bounds.center, _bounds.extents * 2f); text.text = _str; }
private void OnDrawGizmos() { if (p1 == null) { return; } Vector3 _size = (p2.position - p1.position); Vector3 _center = p1.position + _size / 2f; _160_UnityEngineTest.Bounds_.Bounds _bounds = new _160_UnityEngineTest.Bounds_.Bounds(_center, _size); string _str = ""; Gizmos.color = Color.red; _str += "1>>" + _bounds.center + ":" + _bounds.extents; Gizmos.DrawWireCube(_bounds.center, _bounds.extents * 2f); Gizmos.color = Color.green; _bounds.Expand(2f * skinWidth); _str += "\n2>>" + _bounds.center + ":" + _bounds.extents; //DrawWireCube(_bounds.center, _bounds.extents); Gizmos.DrawWireCube(_bounds.center, _bounds.extents * 2f); text.text = _str; //Recalculate.... bottomLeft.Set(_bounds.min.x, _bounds.min.y, 0); bottomRight.Set(_bounds.max.x, _bounds.min.y, 0); topLeft.Set(_bounds.min.x, _bounds.max.y, 0); topRight.Set(_bounds.max.x, _bounds.max.y, 0); //line count... float _dx = _bounds.max.x - _bounds.min.x; intervalX = _dx / (countX - 1); float _dy = _bounds.max.y - _bounds.min.y; intervalY = _dy / (countY - 1); Gizmos.color = Color.red; VerticleDraw(bottomLeft, -1f, distance); VerticleDraw(topLeft, +1f, distance); HorizontalDraw(bottomLeft, -1f, distance); HorizontalDraw(bottomRight, +1f, distance); }