4.4 SolarSystem3D

  Launch example    View color-coded source

The inner solar system with the representations of the sun, mercury, venus, mars, earth and the moon.

Scene Graph
Please refer to 3.4 Scene graph as long as this tutorial is not ready yet.

In this example we linked all planets to the solar system with the centered sun. Because the moon is linked to the earth the moon moves around the sun while rotating around the earth.
	// creates and inits matrix to initialize the solar system
	var initMatrix = new Matrix();
	initMatrix.scale(180, 180, 180);
	sunModel.transform(initMatrix);
	sunModel.draw();
	
	// links all planets to the sun
	for (i = 0; i < planets.length; i++) {
		planets[i].model.linkTo(sunModel);
		planets[i].model.draw();
	}

	// links moon to the earth
	moonModel.linkTo(planets[2].model);
	moonModel.draw();

Additionally you could take a look in the examples folder in the download package for some more scene graph examples.


Links