Hit Data Structure
You use a hit data structure to get information about an item in the hit list. ThevalidMask
field indicates which of the fields in the structure contain valid information. A hit data structure is defined by theTQ3HitData
data type.
typedef struct TQ3HitData { TQ3PickParts part; TQ3PickDetail validMask; unsigned long pickID; TQ3HitPath path; TQ3Object object; TQ3Matrix4x4 localToWorldMatrix; TQ3Point3D xyzPoint; float distance; TQ3Vector3D normal; TQ3ShapePartObject shapePart; } TQ3HitData;
Field Description
part
- The part picked. See "Pick Parts Masks" on page 15-19 for the constants that can be returned in this field.
validMask
- A long integer whose bits specify which of the following fields contain information about a picked object. See "Hit Information Masks" on page 15-17 for a list of the masks you can use to check the bits in this field.
pickID
- The style pick ID in the group of the picked object. The picking ID is a 32-bit value specified by your application. See the chapter "Style Objects" for more information about picking IDs. Picking IDs are especially useful for immediate mode picking. See Listing 15-3 on page 15-15 for a sample routine that uses picking IDs.
path
- The path through the model hierarchy to the picked object, from the root group of the hierarchy to the leaf object. See "Hit Path Structure" on page 15-21 for information about a path. For immediate mode picking, this field is not valid.
object
- A reference to the picked geometry object. For immediate mode picking, this field is not valid.
localToWorldMatrix
- The matrix that transforms the local coordinates of the picked object to world-space coordinates. This matrix is copied from the graphics state in effect at the time the object is hit. If there are multiple references to an object, this matrix may be different for each individual reference.
xyzPoint
- For window-point picking, the point (in world-space coordinates) at which the picked object and the pick geometry intersect. For all other types of picking, this field is undefined.
distance
- For window-point picking, the distance (in world space) from the origin of the picking ray to the point of intersection with the picked object. (This is effectively the distance from the camera to the intersection point, in world space.) For all other types of picking, this field is undefined.
normal
- The surface normal of the picked object at the point of intersection with the pick geometry. This field is valid only for window-point picking.
shapePart
- The shape part object, if any, that was picked. If the picked object has no distinguishable shape parts, this field contains the value
NULL
. If the value of this field is notNULL
, you can call theQ3ShapePart_GetType
function to get the type of this shape part object, orQ3Object_GetLeafType
to get the leaf type of this shape part.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help