I am setting up a simple interface where I have several buttons that will basically be laid out in a circular fashion. I created a circle geometry, and currently I am looking for best way to have these buttons place themselves along the circumference of the circle.
Not sure of best way to accomplish this, doesn’t seem like I can easily access the segments of the circle geometry?
I ended up going with this solution which creates the buttons around the circle!
var radius = 5;
var newPos = new THREE.Vector3();
newPos.x = circle.position.x + radius * Math.sin(45 * i * Math.PI / 180);
newPos.y = circle.position.y + radius * Math.cos(45 * i * Math.PI / 180);
May be a one-liner, setting position directly:
let radius = 5;
let angle = i * Math.PI * 0.25;
btnSphere.position.set( Math.cos( angle ), Math.sin( angle ), 0 ).multiplyScalar( radius ).add( circle.position );