mirror of
https://github.com/WhitestormJS/whs.js.git
synced 2026-01-25 16:08:01 +00:00
50 lines
866 B
JavaScript
50 lines
866 B
JavaScript
import * as UTILS from '@utils';
|
|
|
|
const app = new WHS.App([
|
|
...UTILS.appModules()
|
|
]);
|
|
|
|
const sphere = new WHS.Sphere({ // Create sphere comonent.
|
|
geometry: {
|
|
radius: 3,
|
|
widthSegments: 32,
|
|
heightSegments: 32
|
|
},
|
|
|
|
modules: [
|
|
new PHYSICS.SphereModule({
|
|
mass: 10 // Mass of physics object.
|
|
})
|
|
],
|
|
|
|
material: new THREE.MeshLambertMaterial({
|
|
color: UTILS.$colors.mesh
|
|
}),
|
|
|
|
position: [0, 100, 0]
|
|
});
|
|
|
|
const box = new WHS.Box({ // Create sphere comonent.
|
|
geometry: [2, 2, 2],
|
|
|
|
modules: [
|
|
new PHYSICS.BoxModule({
|
|
mass: 10 // Mass of physics object.
|
|
})
|
|
],
|
|
|
|
material: new THREE.MeshLambertMaterial({
|
|
color: UTILS.$colors.mesh
|
|
}),
|
|
|
|
position: [2, -3, 2]
|
|
});
|
|
|
|
box.addTo(sphere);
|
|
sphere.addTo(app);
|
|
|
|
UTILS.addPlane(app);
|
|
UTILS.addBasicLights(app);
|
|
|
|
app.start(); // Start animations and physics simulation.]
|