Add objects to the editor while the player is running

Hi, I would like to add an object to the scene while the player is running.

I add the object to the scene with the following command:

editor.execute(new AddObjectCommand(myObject));

The problem is that the object does not show up in the player.

To make it work I have to:

  • Stop the scene:

  • Add the object:
    editor.execute(new AddObjectCommand(myObject));

  • Start the scene:

Is it possible to add an object to the scene without restart the player?


Is there anybody who can help me please?


What you are trying to do is not possible, the editor and the player are not connected. The first is to edit/create a scene and export it, to be played by the later…
Imagine your question translated in image editor paradigm (let’s say Photoshop): you ask that when you add an object by a macro in Photoshop you want the resulting jpeg to be updated when shown in a (whatever) external viewer like a browser…

If you want to add an object to the scene exported in the player running, you have to use normal three.js API also exported into your scene, like:

Example a script added on the scene object:

[Scene / script name]
function start (event) {
    var myObject = .... from loader or new instance ...
    scene.add( myObject )

Maybe writing “What you are trying to do is not possible” is less offensive…

1 Like

:sweat_smile: Sorry ! English is not my native language…

I edit my post with you suggestion…

1 Like