---
agentTools:
  projectIndex: https://whsjs.readme.io/llms.txt
---

# Shape

[components / meshes / Shape.js](https://github.com/WhitestormJS/whitestorm.js/blob/dev/src/framework/components/meshes/Shape.js)

`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.

[block:code]
{
  "codes": [
    {
      "code": "const rectWidth = 10,\n  rectLength = 5;\n\nconst rectShape = new THREE.Shape();\nrectShape.moveTo(0,0);\nrectShape.lineTo(0, rectWidth);\nrectShape.lineTo(rectLength, rectWidth);\nrectShape.lineTo(rectLength, 0);\nrectShape.lineTo(0, 0);\n\nconst plane = new WHS.Shape({\n  geometry: {\n    shape: rectShape\n  },\n\n  material: new THREE.MeshBasicMaterial({\n    color: 0xffffff\n  })\n});\n\nplane.addTo(world);\n",
      "language": "javascript"
    }
  ]
}
[/block]

[block:api-header]
{
  "type": "basic",
  "title": "Parameters"
}
[/block]

### Geometry defaults

[block:code]
{
  "codes": [
    {
      "code": "{\n  // ...\n\n  geometry: {\n    shapes: [] // Array of THREE.Shape`s\n  }\n}\n",
      "language": "javascript"
    }
  ]
}
[/block]

> These defaults are additional, there are also defaults filled by `MeshComponent`, etc.

[block:api-header]
{
  "type": "basic",
  "title": "Instructions"
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "{\n  // ...\n\n  geometry: ['shapes']\n}\n",
      "language": "javascript"
    }
  ]
}
[/block]