pub unsafe extern "C" fn PxScene_addBroadPhaseRegion_mut(
    self_: *mut PxScene,
    region: *const PxBroadPhaseRegion,
    populateRegion: bool
) -> u32
Expand description

Adds a new broad-phase region.

The bounds for the new region must be non-empty, otherwise an error occurs and the call is ignored.

Note that by default, objects already existing in the SDK that might touch this region will not be automatically added to the region. In other words the newly created region will be empty, and will only be populated with new objects when they are added to the simulation, or with already existing objects when they are updated.

It is nonetheless possible to override this default behavior and let the SDK populate the new region automatically with already existing objects overlapping the incoming region. This has a cost though, and it should only be used when the game can not guarantee that all objects within the new region will be added to the simulation after the region itself.

Objects automatically move from one region to another during their lifetime. The system keeps tracks of what regions a given object is in. It is legal for an object to be in an arbitrary number of regions. However if an object leaves all regions, or is created outside of all regions, several things happen:

  • collisions get disabled for this object
  • if a PxBroadPhaseCallback object is provided, an “out-of-bounds” event is generated via that callback
  • if a PxBroadPhaseCallback object is not provided, a warning/error message is sent to the error stream

If an object goes out-of-bounds and user deletes it during the same frame, neither the out-of-bounds event nor the error message is generated.

Handle for newly created region, or 0xffffffff in case of failure.