Spawning Objects at Runtime
Very frequently, games or apps add new objects at runtime, maybe as reaction to the user or for spawning a visual effect.
In Wonderland Engine, you can create objects from a custom JavaScript component either using WL.scene.addObject or WL.scene.addObjects.
Add a Single Object
Adding a single object is done via WL.scene.addObject:
|
|
Add Many Objects
For adding multiple objects, WL.scene.addObjects yields better performance:
|
|