The Sun at the Center
Youâre getting to be an expert with 3D objects, so you know the drill. Below the START CODING line, letâs create a cover and a shape, combine them in a mesh, and add it to the scene.
â | âvarâ cover = ânewâ THREE.MeshPhongMaterial({emissive: â'yellow'â}); |
â | âvarâ shape = ânewâ THREE.SphereGeometry(50, 32, 16); |
â | âvarâ sun = ânewâ THREE.Mesh(shape, cover); |
â | scene.add(sun); |
Now that we have a better understanding of these things from Chapter 12, âWorking with Lights and Materialsâ, weâre using a Phong material for the Sun. This lets the Sun emit yellow lightâso it can glow yellow.
The Sun has to do more than glow. It has to shine light on everything else in the solar system. ...
Get 3D Game Programming for Kids, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.