To define a collision entity, the following steps are required:
Step |
Action |
---|---|
1 |
Within the variable declaration, define some collision objects. These are the objects that will be added to the collision groups.
In addition to these objects, some other support variables may be required. |
2 |
Within the variable declaration, define some collision groups. These are the groups that will be added to the collision entity.
|
3 |
Within the variable declaration, define an instance of a collision entity object.
|
4 |
It is possible to add the collision objects to the groups by calling AddCollisionObjects(…). Refer to Defining a Collision Group. |
5 |
Call the method fbEntity.AddCollisionGroup (…) of the entity to add the desired collision groups; it is possible to save the index of a group added to the entity reading the return value of AddCollisionGroup.
NOTE:
|
6 |
If there is the need of reconfiguring an entity, you can use the method fbEntity.Reset(…) of the collision entity to remove all the groups from the entity and then start a new configuration. |
Update the entity before using the entity in a collision or distance query. For this purpose, the following steps must be followed:
Step |
Action |
---|---|
1 |
If required, reconfigure the single collision objects and verify that they are properly configured. This means that xConfigured = TRUE for each object in the list. |
2 |
Perform one of the following steps:
|
3 |
It is possible to verify that fbEntity.xUpdated = TRUE to make sure that 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 an entity. |
If at least one successful update has been performed and no modifications have been performed on the listed groups and on the objects within such groups, there is no need to perform a new Update call.
It is possible to define overlapping groups within the same entity. This does not generate the detection of a self-collision while calling the collision and distance query functions.
The same collision group instance can be added to multiple entities. In the same way, it is possible to get a group from an existing entity and use it individually for the collision and distance queries.