Protocol

SCNBoundingVolume

Properties common to the SCNNode and SCNGeometry classes for measuring location and size.

Declaration

protocol SCNBoundingVolume

Overview

This protocol defines features adopted by both the SCNNode and SCNGeometry classes.

A bounding box is the smallest volume, in the shape of a rectangle aligned to the axes of the local coordinate space, that entirely contains an object. Scene Kit defines a bounding box using two points: a minimum and maximum corner. Similarly, a bounding sphere is the smallest sphere containing an object.

By default, Scene Kit automatically determines the minimal bounding volumes for geometries based on their vertex positions in model space. The bounding volume of a node with an attached geometry is the bounding volume of the geometry, expressed in the node’s local space. The bounding volume of a node containing child nodes is the minimal volume that encloses the bounding volumes of the node’s children.

Scene Kit uses the bounding volume of an object when determining how to render a scene. For example, an SCNCamera object uses the bounding boxes of visible elements in a scene to determine the its depth limits. You can override a bounding volume to change this behavior. For example, if a building model has a long, narrow antenna, the default bounding box includes that feature, so the default camera view for that model will be off-center with respect to the building itself. If you set a new bounding box that includes only the main part of the building, the default camera view will center on the building and ignore the antenna.

Getting and Setting Bounding Volumes

Read the boundingBox or boundingSphere property to retrieve information about an object’s bounding volume. To override the automatically determined bounding volume of an object, set a new value for the boundingBox property.

Topics

Working with Bounding Volumes

var boundingBox: (min: SCNVector3, max: SCNVector3)

The minimum and maximum corner points of the object’s bounding box.

var boundingSphere: (center: SCNVector3, radius: Float)

The center point and radius of the object’s bounding sphere.

Relationships

Inherits From

Conforming Types

See Also

Managing Node Content

var name: String?

A name associated with the node.

var light: SCNLight?

The light attached to the node.

var camera: SCNCamera?

The camera attached to the node.

var geometry: SCNGeometry?

The geometry attached to the node.

var morpher: SCNMorpher?

The morpher object responsible for blending the node’s geometry.

var skinner: SCNSkinner?

The skinner object responsible for skeletal animations of node’s contents.

var categoryBitMask: Int

A mask that defines which categories the node belongs to.