Skip to content
Hunter Close edited this page Aug 15, 2018 · 44 revisions

Overview of 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.

Showing attributes of a shape block

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.

Plus sign on shape block

The attributes menu appears below the (+) sign.

Click on the plus sign to see the attributes menu

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.

Drag attributes over to make them appear on the block

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.

Shape block showing default data for unhidden attributes

Editing data for shape attributes

To edit the data in the attribute, click on the numbers and change them by typing a new number.

Click on data to edit

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.

Drag a variable number block into the data field

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.

Drag a variable vector block into the data field

Custom attributes

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

vel requires a vector input and has the default value vector(0, 0, 0).

acc

acc requires a vector input and has the default value vector(0, 0, 0).

mass

mass requires a single number input and has the default value 0.

charge

charge requires a single number input and has the default value 0.

Specific shapes

box

GlowScript help for box

sphere

GlowScript help for sphere

arrow

GlowScript help for arrow

cylinder

GlowScript help for cylinder

ring

GlowScript help for ring

helix

GlowScript help for helix