generateBox(width:height:depth:cornerRadius:splitFaces:)
Creates a box mesh from a width, height, depth, a radius for the corners, and a Boolean option that splits faces.
Declaration
@MainActor @preconcurrency static func generateBox(width: Float, height: Float, depth: Float, cornerRadius: Float = 0, splitFaces: Bool = false) -> MeshResourceParameters
- width:
The length of the box’s width, in meters, along the x-axis.
- height:
The length of the box’s height, in meters, along the y-axis.
- depth:
The length of the box’s depth, in meters, along the z-axis.
- cornerRadius:
The radius of each corner’s circular arc, in meters. Values for
cornerRadiuscan be, at most, equal to the smallest value of thewidth,height, anddepthparameters. For example, if the box’s dimensions are3.0x4.0x5.0, the corner radius needs to be in the range[0.0, 1.5]. - splitFaces:
A Boolean value that indicates whether you can assign up to six separate materials, one for each face. If
false, you can only assign one material for all six faces.
Discussion
The method centers the box at the entity’s origin and aligns the box’s faces with the coordinate system’s axes.