utrobin ef89823c0a add example Cylinder
Former-commit-id: ebe0ecf74c102233d5f9f946f43f5e896b79ceaf
2017-01-18 01:34:03 +03:00

36 lines
637 B
JavaScript

import * as UTILS from '../../globals';
const world = new WHS.App([
...UTILS.appModules()
]);
const sphere = new WHS.Cylinder({ // Create sphere comonent.
geometry: {
radiusTop: 1,
radiusBottom: 1,
height: 2,
radiusSegments: 32,
heightSegments: 32,
},
modules: [
new PHYSICS.CylinderModule({
mass: 2,
restitution: 1
})
],
material: new THREE.MeshPhongMaterial({
color: UTILS.$colors.mesh
}),
position: new THREE.Vector3(0, 20, 0)
});
sphere.addTo(world);
UTILS.addBoxPlane(world);
UTILS.addBasicLights(world);
world.start(); // Start animations and physics simulation.