CreatePlanet function:

In the createPlanet function, the randomly generated values are passed through the function parameters to create the planets three.js mesh geometry and object as well as the cannon.js shape and rigid body in addition to setting other object settings.

Now that I’ve made a create planet function and random value generating function all that’s left is to create a for loop that calls the createRandomPlanet function passing the parameters to set the centre position of planet cluster and to spawn the amount of planets I want in the cluster.

The next task is to create the object gravity, so that the planets/comets move towards each other and on collide remove the smaller planet and increase the larger planets size.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s