mred
mred copied to clipboard
make, duplicate, destroy, modify a node from a script?
We need the ability to manipulate the scene graph from behaviors.
Some (many) things can be done from scripts. But, @anselm's "garden of flowers" example is one that would be better served this way
- create a flower object in the scene, with behaviors, perhaps a whole like hierarchy under in, and mark it as hidden
- create an empty group, and add a behavior which takes that other flower node as a property
- the script duplicates the flower many times, adding it as a child to itself, positioning it differently, perhaps adjusting properties on the various scripts (e.g., bee-spawn-frequency)
These nodes would last for the life of the player, in the scenes they are in, but would not be saved after play.
This can be done already. Create a script property for the node you want to duplicate. Get it's ThreeJS object. Clone that N times in the start() method of the script. Add to a new Three.Group
I know I can clone the threejs object. I'm talking about the graph object. With all it's scripts and so forth. Just cloning the visual nodes isn't enough.