character_controller_filtering
It is possible to let the character controller ignore some obstacles. This is achieved by configuring the options
argument (an R3QueryOptions, initialized by r3DefaultQueryOptions) of r3KinematicCharacterController_MoveShape.
This structure is detailed in the scene query filters section:
- The
flagsfield of itsfilterallows you to exclude whole families of obstacles (e.g. all the colliders attached to dynamic rigid-bodies withR3_QUERY_EXCLUDE_DYNAMIC). - The
use_groupsandgroupsfields of itsfilterallow you to filter based on the colliders collision groups. - The
exclude_colliderandexclude_rigid_bodyfields of itsfilterexclude one collider, and all the colliders attached to one rigid-body. - Its
predicatefield is an optional callback to filter-out colliders based on user-defined rules. It is given theuserDatafield of the options, a read-only access to the world (anR3ReadContext), and the handle of each collider, and returns a nonzero value to keep that collider as an obstacle.
warning
If the character-controller is used to move a collider (and the rigid-body it may be attached to) that is present
in the physics scene, the filters must be used to exclude that collider (and that rigid-body) from the set of
obstacles (with the exclude_collider and exclude_rigid_body fields of the filter) to prevent the character from
colliding with itself.