I have already created objects around a circle with random position and radius
here is the problem
I want to place the objects only between 0-250° and 290-360°
As you can see in this code, objects appear around the circle as 360°
Now I want to remove objects between 250°-290°
what’s the solution?
here is my code :
for (const i = 1; i < 100; i++) {
const angle = Math.random() * Math.PI * 2;
const radius = 4 + Math.random() * 7;
const x = Math.cos(angle) * radius;
const z = Math.sin(angle) * radius;
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshStandardMaterial({
color: setTintColor(),
});
const cube = new THREE.Mesh(geometry, material);
cube.position.set(x, 0, z);
Thank you Raphael, it works
Can I change the center of rotation of Math.PI?
as you can see objects remove from center of the scene
I want to remove objects in a place other than the center of the scene
I’m sorry for that
I will try to explain more clearly
Usually, when we use Math.PI to create a circle with a desired radius, this circle is created at the center of the scene with the coordinates 0,0,0 and the specified radius.
Now, for example, I want the center of the circle created with Math.PI to be (2,2,0) and with the desired radius.
I made this image for better explanation