I'm attempting to create a swirling motion of multiple objects around a single Vector3 point, each moving in different directions to give the effect of swarming around the center.
Instead of simply wrapping each object in a Container and applying random rotations, I am using a trigonometry approach to project their 3D vectors into 2D positions for labeling above the canvas. However, the container method interferes with the project class.
Below is my current code, which causes all objects to rotate around the central point along the same orbit path:
for(var i = 0; i<objectsArr.length; i++){
var obj = objectsArr[i];
var radius = obj.angle * (Math.PI / 180);
obj.position.x = obj.radius * Math.cos(radius);
obj.position.y = obj.radius * Math.sin(radius);
obj.angle += obj.orbitSpeed;
}
Would anyone happen to know how I can adjust this code so that the objects orbit in random directions along the X, Y, Z axis?