Skip to content
On this page

BoxGeometry

BoxGeometry is a component for a rectangular cuboid with a given width, height, and depth. The cuboid is centred on the origin, with each edge parallel to one of the axes.

Any modifications to the width, height, depth, widthSegments, heightSegments and depthSegments properties will update the underlying THREE.BufferGeometry.

Example

Code

Note: The following code is updated according to the properties set above.

Props

Prop nameDescriptionTypeDefault
name Name of the geometrystring""
width Width along the X axisnumber1
height Height along the Y axisnumber1
depth Depth along the Z axisnumber1
widthSegments Number of segments along the X axis.number1
heightSegmentsNumber of segments along the Y axis.number1
depthSegments Number of segments along the Z axis.number1

Expose

three

You can access the managed THREE.BufferGeometry instance using the exposed three property.

Example code

template
<BoxGeometry ref="geometry" />
ts
const geometry = ref(null);

onMounted(() => {
  // Do something with the THREE.BufferGeometry instance
  const threeGeometry = geometry.value.three;
});

Released under the MIT License.