I am attempting to utilize Three.js to create a collection of points using Three.Points
. My goal is to have these points rotate around a single point or mesh. I have already successfully generated the points randomly within a cylinder region, following the guidance provided in this answer. Additionally, I have explored resources like this, which unfortunately did not produce the desired outcome as it was rotating one mesh around another.
This is my current progress:
//Mesh to be rotated around
const blackHoleGeometry = new THREE.SphereGeometry(10, 64, 64);
const blackHoleMaterial = new THREE.MeshBasicMaterial({
color: 0x000000
});
const blackHole = new THREE.Mesh(blackHoleGeometry, blackHoleMaterial);
scene.add(blackHole);
//Points intended to revolve around the mesh
const particles = new THREE.PointsMaterial({
color: 0xffffff
});
const geometry = new THREE.Geometry();
// [...] code for generating random points
const pointCloud = new THREE.Points(geometry, particles);
pointCloud.rotation.x = Math.PI / 2; //to rotate it by 90 degrees
You can view a complete demo here. How can I achieve the rotation of all points around the sphere mesh? Each vertex of the point "cloud" geometry should revolve around a central point, similar to a planet and its orbiting star.