WHS.Shape
is an universal class, that allows you create different 2D shapes in 3D scene. Unfortunately, all of them don't support physics, so you can make a similar 3D obect and scale it width to be near zero.
WHS.Shape
consist of shapes that are in shapes
parameter.
const rectWidth = 10,
rectLength = 5;
const rectShape = new THREE.Shape();
rectShape.moveTo(0,0);
rectShape.lineTo(0, rectWidth);
rectShape.lineTo(rectLength, rectWidth);
rectShape.lineTo(rectLength, 0);
rectShape.lineTo(0, 0);
const plane = new WHS.Shape({
geometry: {
shape: rectShape
},
material: new THREE.MeshBasicMaterial({
color: 0xffffff
})
});
plane.addTo(world);
Parameters
Geometry defaults
{
// ...
geometry: {
shapes: [] // Array of THREE.Shape`s
}
}
These defaults are additional, there are also defaults filled by
MeshComponent
, etc.
Instructions
{
// ...
geometry: ['shapes']
}
Updated almost 8 years ago