Using World Objects
While RobotMagic encourages the use of Robots of 3D models, it can sometimes be helpful to have access to simple 3D objects such as cubes, spheres, etc. These can be used to exclusively, or in combination with models and/or robots to create more creative worlds. RobotMagic provides a simple way to create and manipulate these 3D objects.
Create Objects
The first step is to create the objects. This can be done using blocks by using the ‘add’ block under the world tab, or by using the addShape() function in JavaScript. There are a variety of 3D shapes to choose from.
Moving, Scaling, and Rotating
Once you have a 3D object in your world, you can manipulate it in various ways including moving, scaling, and rotating it. The respective blocks are shown below with the JavaScript functions moveTo, scale, and rotateBy. The absolute manipulations are shown above but moving and scaling have relative counterparts. Additionally, scale uniquely allows for per dimension manipulation.
Selecting and Grouping
One of the most powerful features of world objects is the ability to group multiple objects and later select the group. This mostly applies to JavaScript but has important applications in the block environment as well. The group block is shown below. Any objects created inside the group share any manipulations including movement, rotation, and scaling. Object properties such as x, y, and z location and others are calculated as the average of the groups constituent objects. In JavaScript, grouping object(s) allows you too retrieve a reference to the object at a later time.
Responding to Events
Like models, you can have your world objects respond to various key presses by using the appropriate event. The block to add a key listener is shown below. Adding Models World objects can also be models, but it's important to keep in mind they are distinct to actors which also have models. World objects that are models have access to all the usual world manipulation and can be helpful when trying to create repetitive scenes.
Final Comments
3D world object provide another way to add 3D assets to your world. Although they are best used in conjunction with models, they can be used exclusively. Almost all the model functionality is present for world objects so the sky’s the limit! If you have any feedback on world objects or RobotMagic in general, please don’t hesitate to get in touch.