Class

SCNBox

A six-sided polyhedron geometry whose faces are all rectangles, optionally with rounded edges and corners.

Declaration

@interface SCNBox : SCNGeometry

Overview

Figure 1

A box and its properties

Define the shape of the box in the x-, y-, and z-axis dimensions of its local coordinate space by setting its width, height, and length properties. Add rounded edges and corners to a box with its chamferRadius property. To position and orient a box in a scene, attach it to the geometry property of an SCNNode object.

Control the level of detail with the widthSegmentCount, heightSegmentCount, lengthSegmentCount, and chamferSegmentCount properties. A higher segment count produces more vertices, which can improve rendering quality for certain lighting models or custom shader effects, but at a cost to rendering performance.

You can assign up to six SCNMaterial instances to a box—one for each side—with its materials property. The SCNBox class automatically creates SCNGeometryElement objects as needed to handle the number of materials.

Topics

Creating a Box

+ boxWithWidth:height:length:chamferRadius:

Creates a box geometry with the specified width, height, length, and chamfer radius.

Adjusting a Box’s Dimensions

width

The extent of the box along its x-axis. Animatable.

height

The extent of the box along its y-axis. Animatable.

length

The extent of the box along its z-axis. Animatable.

Configuring Box Properties

widthSegmentCount

The number of subdivisions in each face of the box along its x-axis. Animatable.

heightSegmentCount

The number of subdivisions in each face of the box along its y-axis. Animatable.

lengthSegmentCount

The number of subdivisions in each face of the box along its z-axis. Animatable.

Adding Rounded Edges and Corners

chamferRadius

The radius of curvature for the edges and corners of the box. Animatable.

chamferSegmentCount

The number of line segments used to create each rounded edge of the box. Animatable.

Relationships

Inherits From

See Also

Basic Shapes

SCNFloor

A plane that can optionally display a reflection of the scene above it.

SCNCapsule

A right circular cylinder geometry whose ends are capped with hemispheres.

SCNCone

A right circular cone or frustum geometry.

SCNCylinder

A right circular cylinder geometry.

SCNPlane

A rectangular, one-sided plane geometry of specified width and height.

SCNPyramid

A right rectangular pyramid geometry.

SCNSphere

A sphere (or ball or globe) geometry.

SCNTorus

A torus, or ring-shaped geometry.

SCNTube

A tube or pipe geometry—a right circular cylinder with a circular hole along its central axis.