Align items in a specific layout


I would like to insert N objects in a scene and align them in a spherichal mood.
Here is an image:

How can i achieve this?
any idea?

One approach to achieve such an effect is demonstrated in the following example:

The idea is to use Vector3.setFromSpherical() or Vector3.setFromSphericalCoords() to generate euclidian coordinates organized in a spherical shape. You can calculate the necessary parameters like this:

const radius = 2;

for ( let i = 1, l = count; i <= l; i ++ ) {

    const phi = Math.acos( - 1 + ( 2 * i ) / l );
    const theta = Math.sqrt( l * Math.PI ) * phi;

    vector.setFromSphericalCoords( radius, phi, theta );

    // do something with vector


count is the amount of your objects.

1 Like

Have a look at this:

It’s also in the sample collection:

Perhaps this example from the collection is helpful:

1 Like