To define a collision group, the following steps are required:
Step |
Action |
---|---|
1 |
Within the variable declaration, define some collision objects. The collision objects are the objects that will be added to the collision group:
In addition to these objects, some other support variables may be required. |
2 |
Within the variable declaration, define an instance of a collision group object:
|
3 |
Call the method fbGroup.AddCollisionObject(…) of the group to add the desired collision objects. You can save the index of an object added to the group reading the return value of AddCollisionObject.
NOTE:
|
4 |
You can use the index value returned on a call of AddCollisionObject to access the right interface from fbGroup.raifCollisionObjects. |
5 |
If you need to reconfigure a group, you can call the method fbGroup.Reset(…) of the collision group to remove the objects from the group and then start a new configuration. |
6 |
Perform an update of the group before using the group in a collision or distance query. To do so, the following steps must be followed:
|
7 |
You can verify fbGroup.xUpdated = TRUE, to verify if the last Update call has been successful. This is a mandatory condition in order to be able to perform a collision or distance query on a group. |
If at least one successful update has been performed and no modifications have been performed on the listed objects, there is no need to perform a new Update call.
It is possible to define overlapping objects within the same group. This does not generate the detection of a self-collision while calling the collision and distance query functions.
The same collision object instance can be added to multiple groups in the same way. It is possible to get a single object from an existing group and use it individually for the collision and distance queries.