WHS.Sphere
class is used to create sphere objects by it's radius
property and other values that determinates it's detality.
It is similar to THREE.SphereGeometry
, but it also contain's all properties, applied by WHS.Shape
, such as material, mass and vectors like position (pos) and rotation (rot).
Then it creates an Three.js mesh
or a Physijs mesh
, that is similar to Three.js mesh
, but it also participates in collision calculations. This mesh is a combination of Three.js geometry
and Physijs material
(The same as in three.js, but with friction and restitution).
const sphere = new WHS.Sphere({
geometry: {
radius: 2
},
material: new THREE.MeshBasicMaterial({
color: 0xffffff
}),
position: {
y: 100
}
});
sphere.addTo(world);
Parameters
Geometry defaults
{
// ...
geometry: {
radius: 1, // Number.
widthSegments: 8, // Number
heightSegments: 6 // Number
}
}
These defaults are additional, there are also defaults filled by
MeshComponent
, etc.
Instructions
{
// ...
geometry: ['radius', 'widthSegments', 'heightSegments']
}
Updated almost 8 years ago