Solar System in Blockly


#1

Recreating our Solar System in CoSpaces Edu seems to be very popular and we’ve seen many cool examples! Here is a way to make the planets orbit the Sun using Blockly.


  1. You can use the ellipsoid from the “Building blocks” category for the Sun and the planets. Place the Sun in the middle of the scene and align all the planets to the left. Name the planets and enable them for Blockly.

  1. Pay attention to the individual distances of each planet to the Sun. We need those values in Blockly later on. The grid helps you with the units.

  1. In order to make a planet orbit the Sun, use the “turn” block (the one with the radius parameter) from the “Transitions” tab. Here, you need to use the appropriate value for the radius and specify the orbit time as well. Put the “turn” block inside a loop to make the planet orbit the Sun repeatedly.

  1. When you press the “Play” button you should see this:

  1. Do the same for the rest of the planets and wrap everything inside an “execute in parallel” block.


This is a very simple example on which you can build and with a little bit of artistic effort you can go pretty far with your Solar System. You could use .obj models for your planets, build a nice background scene, use some arithmetic to get the ratio of the orbit times and size differences between the planets right etc.


Science Specific CoSpaces
#2

Love it! Would be interesting for kids to do even spacing of planets, then actual relative spacing of planets in the next scene.


#3

I tried to use correct (relative) sizes and distances from the Sun once.

It turned out that you’re not going to see much except for the Sun. The size differences (Sun > gas planets > rocky planets) and distances are just too big. So eventually I scaled everything back in order to see my Solar System again :slight_smile: But it was a nice learning experience!

You can use the “scale” block from the “Transitions” tab to set the sizes and in order to place the planets in correct distances you can use the “move to x y z” block.


#4

Very nice, I would also, make my students explain some info on each planet by uploading a mp3 file.


#5

Good idea, in addition to that you can make pop up an info panel when clicking on a planet.


#6

How did you get the “execute in parallel” block to expand? I only see an option to add 2 blocks within it.


#7

You can click on the gear icon and then add more slots.

execute-in-parallel


#8

Benny,
Thank you so much for this detailed tutorial on using Blockly with CoSpaces in this Solar System example. Consider consolidating this blog post into a more formal lesson for those of us who are new to both CoSpaces and Blockly. This blog post really helped me as a teacher to understand the mechanics of how CoSpaces and Blockly work together.

Looking forward to other beginner ‘how-to’ examples showing CoSpaces and Blockly working together!
Judy


#9

We are going to publish small tutorials like this regularly :+1:


#10

Thank you so much
This blog post really helped me as a teacher to understand something new about blockly in CoSpaces .
I hope to see more examples about how to use the blockly code
my greeting


#11

Please
Is there a blockly for " repeat for ever or for infinity "
because I just found repeat for known times not forever
thanks


#12

yes, this is “on update” block in “events” category. its body will be executed forever until you stop it using “stop update” block which is also in “events”