Example #1
0
        private void OnDrawGizmosSelected()
        {
            if (booth == null)
            {
                return;
            }

            var limit         = booth.GetBounds();
            var localPosition = booth.GetWorldToLocal().MultiplyPoint3x4(transform.position);

            if (limit.Contains(localPosition))
            {
                return;
            }

            Gizmos.color = Color.Lerp(Color.red, Color.yellow, Mathf.PingPong(System.DateTime.Now.Millisecond * 0.002f, 1));
            Gizmos.DrawSphere(transform.position, 0.1f);
        }
Example #2
0
        private void DrawOverhangGizmos(ref Bounds bounds)
        {
            var limit = booth.GetBounds();

            Gizmos.matrix = booth.GetLocalToWorld();
            Gizmos.color  = Color.Lerp(Color.red, Color.yellow, Mathf.PingPong(System.DateTime.Now.Millisecond * 0.002f, 1));

            if (limit.max.x < bounds.max.x)
            {
                var overed    = bounds;
                var overedMin = overed.min;
                overedMin.x = Mathf.Max(limit.max.x, bounds.min.x);
                overed.min  = overedMin;

                Gizmos.DrawCube(overed.center, overed.size + rangeOutIndicatorPadding);
            }

            if (limit.max.y < bounds.max.y)
            {
                var overed    = bounds;
                var overedMin = overed.min;
                overedMin.y = Mathf.Max(limit.max.y, bounds.min.y);
                overed.min  = overedMin;

                Gizmos.DrawCube(overed.center, overed.size + rangeOutIndicatorPadding);
            }

            if (limit.max.z < bounds.max.z)
            {
                var overed    = bounds;
                var overedMin = overed.min;
                overedMin.z = Mathf.Max(limit.max.z, bounds.min.z);
                overed.min  = overedMin;

                Gizmos.DrawCube(overed.center, overed.size + rangeOutIndicatorPadding);
            }

            if (limit.min.x > bounds.min.x)
            {
                var overed    = bounds;
                var overedMax = overed.max;
                overedMax.x = Mathf.Min(limit.min.x, bounds.max.x);
                overed.max  = overedMax;

                Gizmos.DrawCube(overed.center, overed.size + rangeOutIndicatorPadding);
            }

            if (limit.min.y > bounds.min.y)
            {
                var overed    = bounds;
                var overedMax = overed.max;
                overedMax.y = Mathf.Min(limit.min.y, bounds.max.y);
                overed.max  = overedMax;

                Gizmos.DrawCube(overed.center, overed.size + rangeOutIndicatorPadding);
            }

            if (limit.min.z > bounds.min.z)
            {
                var overed    = bounds;
                var overedMax = overed.max;
                overedMax.z = Mathf.Min(limit.min.z, bounds.max.z);
                overed.max  = overedMax;

                Gizmos.DrawCube(overed.center, overed.size + rangeOutIndicatorPadding);
            }
        }