Exemplo n.º 1
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (this.enabled && this.gameObject.activeInHierarchy && drawRectDebug)
            {
                drawer.color = LeapColor.jade;

                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(portalObj.transform.TransformPoint(Vector3.forward * depthOffset), portalObj.transform.rotation, portalObj.transform.lossyScale);

                drawer.DrawWireCube(Vector3.zero, new Vector3(portalObj.width, portalObj.height, thickness));
                drawer.DrawWireCube(Vector3.zero, new Vector3(portalObj.width * 0.8f, portalObj.height * 0.8f, thickness));

                drawer.PopMatrix();

                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(portalObj.transform.TransformPoint(Vector3.forward * depthOffset), portalObj.transform.rotation, Vector3.one);

                drawer.color = LeapColor.magenta;
                if (!infiniteWidth || !infiniteHeight)
                {
                    var width  = 100000f;
                    var height = 100000f;

                    if (!infiniteWidth)
                    {
                        width = maxScrollWidth;
                    }
                    if (!infiniteHeight)
                    {
                        height = maxScrollHeight;
                    }

                    drawer.DrawWireCube(Vector3.zero, new Vector3(width, height, thickness));
                }

                drawer.PopMatrix();
            }
        }
Exemplo n.º 2
0
        private void drawBoxGizmos(RuntimeGizmoDrawer drawer, Vector3 center, Vector3 radii)
        {
            drawer.DrawWireCube(center, radii * 2f);

            drawer.color = drawer.color.WithAlpha(0.05f);
            int   div    = 3;
            float invDiv = 1f / div;

            for (int i = 0; i < div; i++)
            {
                for (int j = 0; j < div; j++)
                {
                    for (int k = 0; k < div; k++)
                    {
                        drawer.DrawWireCube((center + (new Vector3(i, j, k) - radii) * invDiv * 2),
                                            radii * invDiv * 2f);
                    }
                }
            }

            drawer.color = drawer.color.WithAlpha(0.04f);
            drawer.DrawCube(center, radii * 2f);
        }
Exemplo n.º 3
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            Rigidbody body = GetComponent <Rigidbody>();

            if (body == null)
            {
                return;
            }

            drawer.PushMatrix();
            drawer.matrix = this.transform.localToWorldMatrix;
            drawer.color  = Color.red;
            drawer.DrawWireCube(Vector3.zero, Vector3.one * 0.01F);
            drawer.PopMatrix();
        }
Exemplo n.º 4
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (_isSimulating && _drawRuntimeGizmos)
            {
                drawer.color = Color.red;

                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(_position, _rotation, Vector3.one);

                drawer.DrawWireCube(Vector3.zero, Vector3.one * 0.05f);

                drawer.color = Color.red;
                drawer.DrawLine(Vector3.zero, Vector3.right * 0.10f);
                drawer.color = Color.green;
                drawer.DrawLine(Vector3.zero, Vector3.up * 0.10f);
                drawer.color = Color.blue;
                drawer.DrawLine(Vector3.zero, Vector3.forward * 0.10f);

                drawer.PopMatrix();
            }
        }
Exemplo n.º 5
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            var mesh = polyMesh;

            if (mesh == null)
            {
                return;
            }

            // Verts.
            foreach (var poly in mesh.polygons)
            {
                int vertIdx = 0;
                drawer.color = debugVertColor;
                foreach (var vertPos in poly.verts.Query().Select(vIdx => poly.GetMeshPosition(vIdx)))
                {
                    drawer.DrawWireSphere(vertPos, PolyMath.POSITION_TOLERANCE * debugVertRadiusMult);
                    drawer.DrawWireCube(vertPos, Vector3.one * PolyMath.POSITION_TOLERANCE * debugVertRadiusMult);
                    vertIdx++;
                }
            }
        }