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

This code worked very well Thank you very much @mvaligursky .

var Line = pc.createScript('line');

Line.prototype.update = function(dt) {
  var center = new pc.Vec4();
  var color = pc.Color.RED;
  var radius = 10;
  var numSegments = 100;
  this.renderArc(center, radius, numSegments, color);
};

Line.prototype.renderArc = function (center, radius, numSegments, color) {
  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));

      colors.push(color, color);
  }
  this.app.renderLines(points, colors);
};

1 Like