Bounding Boxes
A bounding box is a polygon that is attached to a bone. Like other attachments, when the bone is transformed, the polygon is also transformed. Bounding boxes can be used at runtime for hit detection, creating physics bodies, spawning particle effects, and more.
The term "bounding box" is somewhat of a misnomer. Technically a bounding box is the smallest rectangle that contains an object. In Spine, bounding boxes are actually arbitrary polygons, though they are often used to define the bounds of the skeleton for hit detection or physics purposes.
Setup
To create a new bounding box, select a bone or slot in the tree, then choose New...
Bounding Box
in the properties at the bottom of the tree.
The new bounding box appears in the tree and Edit
mode is automatically selected.
The New
mode inside of the Edit
mode is also automatically selected.
Edit mode
While in New
mode, clicking in the editor area will create new polygon vertices. Vertices can also be translated by dragging or deleted by double clicking. When the polygon is complete, exit New
mode by clicking the first vertex to close the shape or by clicking the New
button.
Edit
mode has two tools:
Create
allows new vertices to be created along the edges of the polygon by clicking.Delete
allows vertices or edges to be deleted by clicking.
With either tool, vertices can be translated by dragging or deleted by double clicking. Right click switches tools.
Edit
mode can be exited at any time by pressing spacebar
or escape
, by clicking the Edit
button in the properties at the bottom of the tree, or by closing the Edit Bounding Box
dialog.
Transform tools
The bounding box vertices can be edited outside of Edit
mode by using the transform tools. The entire bounding box can be rotated, translated, and scaled like any other attachment.
Individual vertices can be translated with any transform tool by dragging. Multiple vertices can be selected by holding ctrl
(cmd
on Mac), then clicking or dragging to box select. The selected vertices can be deselected by pressing spacebar
or escape
, or by clicking in any empty space.
The origin used for rotation or scaling can be changed. Mouse over the small crosshair at the center of the Rotate
or Scale
tool until a circle appears, then drag the origin to the desired position. The origin will automatically snap to vertices.
Keying
Like keying meshes, when a bounding box's vertices have been manipulated in animate mode, the bounding box can be keyed.
Weights
Bounding boxes can be automatically deformed when bones are transformed. See Weights for more information.