World::QueryProximity
Defined in:
Enumerates the world geometry nodes and rigid bodies that intersect a sphere.
C4World.hPrototype
void QueryProximity(const Point3D& center, float radius, ProximityCallback *callback, void *cookie, int32 threadIndex = ThreadMgr::kMaxWorkerThreadCount) const;
Parameters
center |
The center of the sphere in world space. |
radius |
The radius of the sphere. This must be positive. |
callback |
A pointer to a callback function that is invoked for each node intersecting the sphere. |
cookie |
A user-defined pointer that is passed to the callback function specified by the callback parameter.
|
threadIndex |
The index of the Thread Manager worker thread that is calling this function. |
Description
The QueryProximity function searches the world for all geometry nodes and rigid bodies having bounding volumes that intersect the sphere given by the center and radius parameters. For each geometry node or rigid body found, the callback function specified by the callback parameter is invoked. The ProximityCallback type is defined as follows.
typedef ProximityResult ProximityCallback(Node *node, const Point3D& center, float radius, void *cookie);
node parameter passed to the callback function is either a geometry node or a node of any type to which a rigid body controller is attached. The center, radius, and cookie parameters are the same as those passed to the QueryProximity function. The callback function should return one of the following constants to determine how the enumeration proceeds.
kProximityContinue |
Continue visting nodes normally. |
kProximitySkipSuccessors |
Do not visit any successors of the current node. |
kProximityStop |
Stop the proximity query at the current node. |
node parameter, then it must return either kProximitySkipSuccessors or kProximityStop.The
threadIndex parameter specifies the index of the Thread Manager worker thread that has called the QueryProximity function. If the QueryProximity function is called from the main thread, then this parameter should not be specified so that the default value is used. If the QueryProximity function is called from a job, then the threadIndex parameter should be set to the value returned by the Job::GetThreadIndex function. The threadIndex parameter must be set correctly in order for multithreaded proximity queries to work properly.
IMPORTANT. If the
QueryProximity function is called from inside a Thread Manager worker thread, then the application code must ensure that the scene is not modified while the job is running.
See Also
