LineDrawer.Draw_Line(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Color, UnityEngine.Color, float)

Here are the examples of the csharp api LineDrawer.Draw_Line(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Color, UnityEngine.Color, float) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

19 View Source File : LineDrawer.cs
License : MIT License
Project Creator : dag10

protected bool Draw_Cube(Vector3 point, Color color, float halfSize = DefaultLineWidth)
    {
        return Draw_Line(point - Vector3.right * halfSize, point + Vector3.right * halfSize, color, color, halfSize);
    }

19 View Source File : LineDrawer.cs
License : MIT License
Project Creator : dag10

protected bool Draw_Box(Vector3 center, Quaternion rotation, Color color, Vector3 halfSize, float lineWidth = DefaultLineWidth)
    {
        bool needsUpdate = false;

        Vector3 basisX = rotation * Vector3.right;
        Vector3 basisY = rotation * Vector3.up;
        Vector3 basisZ = rotation * Vector3.forward;
        Vector3[] pts =
        {
            center + basisX * halfSize.x + basisY * halfSize.y + basisZ * halfSize.z,
            center + basisX * halfSize.x + basisY * halfSize.y - basisZ * halfSize.z,
            center - basisX * halfSize.x + basisY * halfSize.y - basisZ * halfSize.z,
            center - basisX * halfSize.x + basisY * halfSize.y + basisZ * halfSize.z,

            center + basisX * halfSize.x - basisY * halfSize.y + basisZ * halfSize.z,
            center + basisX * halfSize.x - basisY * halfSize.y - basisZ * halfSize.z,
            center - basisX * halfSize.x - basisY * halfSize.y - basisZ * halfSize.z,
            center - basisX * halfSize.x - basisY * halfSize.y + basisZ * halfSize.z
        };

        // Bottom
        needsUpdate |= Draw_Line(pts[0], pts[1], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[1], pts[2], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[2], pts[3], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[3], pts[0], color, color, lineWidth);

        // Top
        needsUpdate |= Draw_Line(pts[4], pts[5], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[5], pts[6], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[6], pts[7], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[7], pts[4], color, color, lineWidth);

        // Vertical lines
        needsUpdate |= Draw_Line(pts[0], pts[4], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[1], pts[5], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[2], pts[6], color, color, lineWidth);
        needsUpdate |= Draw_Line(pts[3], pts[7], color, color, lineWidth);

        return needsUpdate;
    }

19 View Source File : LineDrawer.cs
License : MIT License
Project Creator : dag10

protected bool Draw_TransformBasis(Transform transformToDraw, float basisLength = DefaultBasisLength, float lineWidth = DefaultLineWidth * 2.0f)
    {
        // Basis
        bool needsUpdate = false;
        needsUpdate |= Draw_Line(transformToDraw.transform.position, transformToDraw.transform.position + transformToDraw.transform.right * basisLength, Color.red, Color.red, lineWidth);
        needsUpdate |= Draw_Line(transformToDraw.transform.position, transformToDraw.transform.position + transformToDraw.transform.up * basisLength, Color.green, Color.green, lineWidth);
        needsUpdate |= Draw_Line(transformToDraw.transform.position, transformToDraw.transform.position + transformToDraw.transform.forward * basisLength, Color.blue, Color.blue, lineWidth);

        return needsUpdate;
    }

19 View Source File : LineDrawer.cs
License : MIT License
Project Creator : dag10

protected bool Draw_Circle(Vector3 center, Vector3 normal, Color color, float radius = 0.25f, float lineWidth = DefaultLineWidth)
    {
        bool returnValue = false;
        float theta = 0;
        float radPerPoint = (2.0f * Mathf.PI) / (float)PointsOnCircle;
        Quaternion q = Quaternion.FromToRotation(Vector3.up, normal);
        Vector3 start = q * new Vector3(Mathf.Cos(theta) * radius, 0.0f, Mathf.Sin(theta) * radius) + center;

        for (int i = 1; i <= PointsOnCircle; i++)
        {
            theta = (i % PointsOnCircle) * radPerPoint;

            Vector3 end = q * new Vector3(Mathf.Cos(theta) * radius, 0.0f, Mathf.Sin(theta) * radius) + center;
            returnValue |= Draw_Line(start, end, color, color, lineWidth);

            start = end;
        }

        return returnValue;
    }

19 View Source File : LineDrawer.cs
License : MIT License
Project Creator : dag10

protected bool Draw_Circle_Partial(Vector3 center, Vector3 normal, Color color, float radius = 0.25f, float lineWidth = DefaultLineWidth, float circleAngleArc = 360.0f)
    {
        bool returnValue = false;
        float theta = 0;
        float radPerPoint = (circleAngleArc * Mathf.Deg2Rad * 0.5f) / (float)PointsOnCircle;
        Quaternion q = Quaternion.FromToRotation(Vector3.up, normal);
        Vector3 start0 = q * new Vector3(Mathf.Cos(theta) * radius, 0.0f, Mathf.Sin(theta) * radius) + center;
        Vector3 start1 = q * new Vector3(Mathf.Cos(theta) * -radius, 0.0f, Mathf.Sin(theta) * -radius) + center;

        int maxPointCount = (circleAngleArc < 360.0f) ? (PointsOnCircle - 1) : PointsOnCircle;
        for (int i = 1; i <= maxPointCount; i++)
        {
            theta = (i % PointsOnCircle) * radPerPoint;

            Vector3 end0 = q * new Vector3(Mathf.Cos(theta) * radius, 0.0f, Mathf.Sin(theta) * radius) + center;
            Vector3 end1 = q * new Vector3(Mathf.Cos(theta) * -radius, 0.0f, Mathf.Sin(theta) * -radius) + center;
            returnValue |= Draw_Line(start0, end0, color, color, lineWidth);
            returnValue |= Draw_Line(start1, end1, color, color, lineWidth);

            start0 = end0;
            start1 = end1;
        }

        return returnValue;
    }