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 name | Description | Type | Default |
---|---|---|---|
name | Name of the geometry | string | "" |
width | Width along the X axis | number | 1 |
height | Height along the Y axis | number | 1 |
depth | Depth along the Z axis | number | 1 |
widthSegments | Number of segments along the X axis. | number | 1 |
heightSegments | Number of segments along the Y axis. | number | 1 |
depthSegments | Number of segments along the Z axis. | number | 1 |
Expose
three
You can access the managed
THREE.BufferGeometry
instance using the exposedthree
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;
});