-
Notifications
You must be signed in to change notification settings - Fork 3
Shapes
There are six shape blocks in GlowScript Blocks: box, sphere, arrow, cylinder, ring, & helix. In the GlowScript documentation, these "shapes" are called "3D objects".
Each GlowScript shape has its own set of attributes. For example, sphere has a radius, but box does not; instead, box has three dimensions length, height, and width that determine its size and shape. Both sphere and box have the pos attribute, which represents the position of the object.
Shape blocks have too many attributes to show at once because the block would become too large (vertically on the screen). The attributes are initially hidden. To view a shape's attributes, click on the (+) sign on the block.
The attributes menu appears below the (+) sign.
Attributes can then be dragged over into the white area and attached to the bottom of the chain. As the attributes are brought over, the block itself expands to show the additional attributes.
Click on the (+) sign again to hide the attributes menu.
The attribute is pre-loaded with default data for the unhidden attributes. The default data for any attribute for any shape is described in the GlowScript documentation for that shape.
To edit the data in the attribute, click on the numbers and change them by typing a new number.
Or, another block, like a variable block, that has been assigned a numerical value can be dragged into that spot inside the attribute data block.
If the attribute is a vector, then a variable that has been assigned to a vector can be dragged into that attribute spot on the shape block.
GlowScript directly interprets the pos attribute as the position of the shape, but it does not directly interpret the attributes vel (velocity), acc (acceleration), mass, or charge (electric charge) without any additional input from the user. These attributes are commonly needed in physics simulations. In GlowScript code, the user can easily add them as needed, but in GlowScript blocks, the user does not have this freedom, so commonly added attributes have been provided in the structure of GlowScript Blocks.
vel requires a vector input and has the default value vector(0, 0, 0)
.
acc requires a vector input and has the default value vector(0, 0, 0)
.
mass requires a single number input and has the default value 0
.
charge requires a single number input and has the default value 0
.