[SOLVED] How to make a simple circle line (not shaded)?

you could render a circle using lines. I have this code which renders a sphere using 3 circles … perhaps extract a single circle from it.

        addSphere: function (center, radius, numSegments, color, duration, options, id) {
            duration = duration || 0;

            var points = [];
            var colors = [];

            var step = 2 * Math.PI / numSegments;
            var angle = 0, i;
            for (i = 0; i < numSegments; i++) {
                var sin0 = Math.sin(angle);
                var cos0 = Math.cos(angle);
                angle += step;
                var sin1 = Math.sin(angle);
                var cos1 = Math.cos(angle);

                points.push(
                    new pc.Vec3(center.x + radius * sin0, center.y, center.z + radius * cos0), new pc.Vec3(center.x + radius * sin1, center.y, center.z + radius * cos1),
                    new pc.Vec3(center.x + radius * sin0, center.y + radius * cos0, center.z), new pc.Vec3(center.x + radius * sin1, center.y + radius * cos1, center.z),
                    new pc.Vec3(center.x, center.y + radius * sin0, center.z + radius * cos0), new pc.Vec3(center.x, center.y + radius * sin1, center.z + radius * cos1)
                );

                colors.push(color, color, color, color, color, color);
            }
            lines.push(new DebugLine(points, colors, _currentTime + duration, id, options));
        },

3 Likes