Exemplo n.º 1
0
            public override void Draw(IGizmoRenderer renderer)
            {
                Quaternion rot = Quaternion.FromToRotation(Vector3.forward, normal);

                Vector2 halfExt = size / 2;

                Quaternion localRot = Quaternion.AngleAxis(degrees, Vector3.forward);

                Vector3[] verts =
                {
                    localRot *new Vector3(-halfExt.x, halfExt.y, 0),   // top-left
                    localRot *new Vector3(halfExt.x,  halfExt.y, 0),   // top-right
                    localRot *new Vector3(halfExt.x,  -halfExt.y, 0),  // bottom-right
                    localRot *new Vector3(-halfExt.x, -halfExt.y, 0),  // bottom-left
                };

                for (int i = 0; i < verts.Length; ++i)
                {
                    int endIdx = (i + 1) % (verts.Length);

                    Vector3 legStart = (position + rot * verts[i]);
                    Vector3 legEnd   = (position + rot * verts[endIdx]);

                    renderer.DrawLine(legStart, legEnd);
                }
            }
Exemplo n.º 2
0
            public override void Draw(IGizmoRenderer renderer)
            {
                float      step = 2 * Mathf.PI / (float)sides;
                Quaternion rot  = Quaternion.FromToRotation(Vector3.forward, normal);

                for (int i = 0; i < sides; ++i)
                {
                    int startIdx = i;
                    int endIdx   = (i + 1) % (sides);

                    Vector3 legStart = rot * new Vector3(radius * Mathf.Cos(step * startIdx), radius * Mathf.Sin(step * startIdx), 0.0f);
                    Vector3 legEnd   = rot * new Vector3(radius * Mathf.Cos(step * endIdx), radius * Mathf.Sin(step * endIdx), 0.0f);

                    renderer.DrawLine(position + legStart, position + legEnd);
                }
            }
Exemplo n.º 3
0
 public override void Draw(IGizmoRenderer renderer)
 {
     renderer.DrawCube(position, size);
 }
Exemplo n.º 4
0
 public override void Draw(IGizmoRenderer renderer)
 {
     renderer.DrawSphere(position, radius);
 }
Exemplo n.º 5
0
 public abstract void Draw(IGizmoRenderer renderer);
Exemplo n.º 6
0
 public virtual void BeforeDraw(IGizmoRenderer renderer)
 {
     renderer.SetColor(color);
     renderer.SetTRS(matrix);
 }
Exemplo n.º 7
0
 public override void Draw(IGizmoRenderer renderer)
 {
     renderer.DrawLine(startPosition, endPosition);
 }