Skip to content

NgtsRoundedBox

NgtsRoundedBox is a port of Drei’s RoundedBox which renders a box with rounded edges. Creates smooth, beveled corners on all edges of the box.

Usage

import { NgtsRoundedBox } from 'angular-three-soba/abstractions';
<ngts-rounded-box [options]="{ width: 2, height: 1, depth: 1, radius: 0.1 }">
<ngt-mesh-standard-material color="orange" />
</ngts-rounded-box>

Custom Material

NgtsRoundedBox accepts custom material(s) via content projection.

<ngts-rounded-box [options]="{ width: 1.5, height: 1.5, depth: 1.5, radius: 0.2, smoothness: 8 }">
<ngt-mesh-physical-material [metalness]="0.5" [roughness]="0.3" color="gold" />
</ngts-rounded-box>

Options

options input accepts any properties from THREE.Mesh in addition to the following:

Properties

name type description
width number Width of the box (X-axis). Default: 1
height number Height of the box (Y-axis). Default: 1
depth number Depth of the box (Z-axis). Default: 1
radius number Radius of the rounded corners. Default: 0.05
smoothness number Number of curve segments for corner smoothness. Default: 4
bevelSegments number Number of bevel segments. Default: 4
steps number Number of extrusion steps. Default: 1
creaseAngle number Angle threshold for creased normals calculation (radians). Default: 0.4