#import <CC3UtilityMeshNodes.h>
Properties | |
CC3Box | box |
BOOL | shouldAlwaysMeasureParentBoundingBox |
CC3TouchBox is a specialized node that creates an invisible box mesh that can be used to define a 3D region for touch activity.
If you do not set the box property explicitly, when you add an instance of this class as a child of another CC3Node, this node will automatically be populated as a box the same size as the bounding box of that parent. If the parent node contains other nodes, its bounding box will include its descendants, resulting in this mesh being populated to encapsulate all descendant nodes of its parent. The effect is to define a box-shaped touch region around a composite node that might be comprised of a number of smaller nodes with space in between them.
If the parent node contains descendants that are moving around, the bounding box of the parent node may be dynamic and constantly changing. If you want the touch box to track changes to the parent bounding box, set the shouldAlwaysMeasureParentBoundingBox property to YES.
You can also set the box property directly to create a box that is shaped differently than the bounding box of the parent. For example, you might want to do this if you want the touch box to be larger than the actual visible nodes, in order to make it easier to touch.
The mesh underlying this node is automatically populated when you set the box property, or when you add this node to a parent. You do not need to invoke any of the populateAs... methods directly.
Since this node is intended to be used as an invisible touch pad, the visible property of this node is initially set to NO, and the shouldAllowTouchableWhenInvisible property is initially set to YES. In addition, the bounding box of this mesh will not contribute to the bounding box of the parent.
|
readwritenonatomicassign |
Indicates the size of the touch box.
Setting this property populates this node with a box mesh of the specified extent.
Instead of setting this property directly, you can automatically create the box mesh by simply adding this node to a parent CC3Node. If this property has not already been set when this node is added to a parent, the value of this property will automatically be set to the value of the boundingBox property of the parent.
If the parent node contains descendants that are moving around, the bounding box of the parent node may be dynamic and constantly changing. If you want the touch box to track changes to the parent bounding box, set the shouldAlwaysMeasureParentBoundingBox property to YES.
If you set this property directly, and then subsequently add this node to a parent, the value of this property will not change, and the underlying mesh will not be repopulated. By setting the value of this property directly, you can create a mesh box that is of a different size than the parent bounding box.
Setting this property to kCC3BoxNull will remove the underlying mesh.
The initial value of this property is kCC3BoxNull.
|
readwritenonatomicassign |
Indicates whether the dimensions of this node should automatically be remeasured on each update pass.
If this property is set to YES, the box will automatically be resized to account for movements by any descendant nodes of the parent node. To create a dynamic touch box that automatically adjusts as the descendants of the parent node move around, this property should be set to YES.
It is not necessary to set this property to YES to account for changes in the transform properties of the parent node itself.
When setting this property, be aware that dynamically measuring the bounding box of the parent node can be an expensive operation if the parent contains a number of descendant nodes.
The initial value of this property is NO.