YG Syntax

YG is structured around the idea of nodes. Everything in a YG scene is a node - 3D objects, sounds, scripting for interaction, animations, text, etc. Every node has a different set of messages, which are used to set parameters for the node and also send information between nodes.

Here is an example node definition to load a sphere and place it in the world:

object bigball (file("redsphere.b3d"),position(0 15 5),size(4))

object is the type of node

bigball is a name given to the node. You can name a node anything you want; naming is optional, but is useful both to help organize your scene. You have to name nodes if you want to control them later, through interaction or animations.

file is a message for the object node, telling it what file to load. YG looks for files in the yg/data directory, or as specified in the RUN script.

position is a message which tells the object where it should be placed. 0 15 5 are the coordinates of the object (X Y Z). In YG, 'Z' is the Up coordinate - so 0 15 5 means "15 feet forward and 5 feet up". You an enter decimal values, and also negative values.

size is a message that scales the object. size(4) makes the object 4 times its normal size.

Parentheses are very important in YG. The definition of a node is contained in parentheses, and the values for each message are contained in parentheses. Messages are separated by commas, but the values inside each message are separated by spaces.

Every object has different messages, as listed in the reference pages.


(c) Ben Chang