Skip to main content

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 flags field of its filter allows you to exclude whole families of obstacles (e.g. all the colliders attached to dynamic rigid-bodies with R3_QUERY_EXCLUDE_DYNAMIC).
  • The use_groups and groups fields of its filter allow you to filter based on the colliders collision groups.
  • The exclude_collider and exclude_rigid_body fields of its filter exclude one collider, and all the colliders attached to one rigid-body.
  • Its predicate field is an optional callback to filter-out colliders based on user-defined rules. It is given the userData field of the options, a read-only access to the world (an R3ReadContext), 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.