CreateItem objects


I would like to ‘code’ as much as possible (i.e. write typescript lines of code instead of dragging objects into the scenes) in order to replicate easily specific sets of objects and maintain elsewhere on my pc a library of scenes. It seems that the CreateItem function doesn’t work with every object… it works at least with one more object not enlisted in the help section (FxCd) but it doesn’t work with Circle and Square graphics elements. I’m would like to create paths on the floor with a series of circles; when a users activate a circle, he/she moves to that circle, and so on. Having the opportunity to create them by code will ease my process. Is there any chance to have CreateItem supporting more objects, like Circle and Square? Thanks.


Hi Mario,

for example, if you want to create a circle, you can use the “Ellipsoid” object and make it flat using the .setSize() method. The same is true for the square, just use the “Cuboid” and make it flat using this method. Here is some code implementing your example:

const cam = Scene.getItem('cam');
const N = 3;

for(let i = 0; i < N; i++) {
    // calculate (x, y) position of the circle
    const x = i * 3;
    const y = i * 4;

    // make a red circle by creating a flat ellipsoid
    const circle = Scene.createItem('Ellipsoid', x, y, 0);
    circle.setSize(0.7, 0.7, 0.01);
    circle.setColor(255, 0, 0);

    // when clicking on this circle, move the camera to its position
    circle.onActivate(() => {
        cam.setPosition(x, y, 0);

Link to the scene:


Hello mariochiesa,

thank you for request!
Unfortunately at the moment there is no method to create flat circle or square from object library with TS. Definitely we will support it in the next version.


Hello mariochiesa,

now it is possible to create flat squares and circles using method createItem:

Scene.createItem("Circle", 0, 0, 0);
Scene.createItem("Square", 0, 0, 0);