App
class inheritsModuleSystem
This component is used to prepare a world scene, setup physics, camera, renderer and all other things that you usually do before making meshes.
Methods
.start()
Start rendering loop and physics simulation (if you use version with physics).
.addLoop(loop) & .removeLoop(loop)
Adds loop to this app.
const loop = new WHS.Loop(() => {
// ...
});
const world = new WHS.App();
world.addLoop(loop);
loop.start();
Faster way
You can add loop to app and start it in one line.
To do this - pass world as argument to start:loop.start(world);
Modules
new WHS.App
takes an array of modules as constructor arguments.
const world = new WHS.App([
// put your app modules here
]);
You can also use new WHS.BasicAppPreset
to speed up development.
There are a collection of app modules which can only be used with an App
instance.
You can also use other modules with the an App
instance like controls
and PHYSICS.
Properties
.render
(boolean)
.render
(boolean)Defines if scene is rendered each frame or not. The following script will disable rendering:
world.render = false;
.simulate
(boolean)
.simulate
(boolean)Same as .render
, but for physics. Defines if physics is simulated each frame.
.loops
(array)
.loops
(array)Array of loops that are executed by this world object.
Updated over 7 years ago