Boxshot creates objects inside the scene hierarchy. You can’t just create an object, you have to create it as someone’s child. Usually your objects will be children of the scene root node. To create a sphere object in the root node, run this code:

scene.root.addMesh("sphere", "generator.simple.sphere");

The scene object has the root variable, that you will use very often. The addMesh() method got two parameters: object name and the mesh identifier. The name is up to you, but the identifier has to be correct, as Boxshot uses it to understand which mesh are you going to create.

You don’t need to guess the identifiers, because there is a sample script at the end of each shape page in this manual. Go to the sphere shape page and scroll to the bottom to see how to create and adjust the sphere object. That’s easy.

Creating lights

Lights are created the similar way, just using another method:

var l = scene.root.addLight("a light");

Please note that you may assign the created object to a variable to use it later. For example you may set the light position and intensity using the code below:

l.translation  = vec3(10, 20, 30);
l.intensity = 5;

More information about lights scripting is here.

Creating groups

Groups are nodes that contains other nodes. They are extremely useful if you’d like to do some animation for several nodes at once. You may rotate some objects around the point, or scale them altogether. The script again looks similar:

scene.root.addGroup("a group");

You may assign the new object to a variable to use it later. Read more about moving objects to get the most out of group nodes.