Protocol

SCNBoundingVolume

Methods 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

Use the getBoundingBoxMin:max: or getBoundingSphereCenter:radius: method to retrieve information about an object’s bounding box or sphere. To override the automatically determined bounding volume of an object, use the setBoundingBoxMin:max: method.

Topics

Measuring an Object’s Bounding Volume

- getBoundingBoxMin:max:

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

Required.

- getBoundingSphereCenter:radius:

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

Required.

Overriding an Object’s Default Bounding Volume

- setBoundingBoxMin:max:

Sets a custom bounding box for the object.

Required.

Relationships

Inherits From

Conforming Types

See Also

Managing Node Content

name

A name associated with the node.

light

The light attached to the node.

camera

The camera attached to the node.

geometry

The geometry attached to the node.

morpher

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

skinner

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

categoryBitMask

A mask that defines which categories the node belongs to.