Function apply_radial_impulse

Source
pub fn apply_radial_impulse<W>(
    world: &mut W,
    request: RadialImpulseRequest,
    candidates: &mut [Option<<W as Adapter>::Candidate>],
    output: &mut [Option<RadialImpulse>],
) -> Result<RadialImpulseReport, RadialImpulseError>
where W: RadialWorld,
Expand description

Check the complete blast, then apply existing body COM-impulse methods once per accepted body. See the module for runnable recipes in both dimensions.

candidates is dimensional Option<OverlapHit> scratch. Every query hit must fit, including fixed/kinematic/sensor children; the caller can size it to the world’s collider count. output.len() >= request.max_bodies is required even for a miss. Every Err preserves all accepted output entries. Success writes exactly report.applied entries and clears the entire remaining output.

Work is bounded by the requested live-collider limit, the existing bounded arenas and caller slice lengths: one numeric guard pass, one existing overlap pass (sorted insertion at most O(C * min(C, scratch.len()))), in-place unstable O(H log H) canonical sorting, and bounded body/child passes. There is no heap allocation. This is a work-admission bound, not a time/throughput guarantee.

Falloff is derived from task220’s signed separation, never a body-origin radius test. Nonzero impulses that round to zero are omitted. Total-budget distribution is not renormalized after f32 underflow. All f32 multiply/add intermediates used by the existing impulse method are checked, not just the wider mathematical result. Pending child mass edits reject without refreshing. Forces, torque, angular velocity and kinematic targets are never modified. No bitwise cross-platform determinism or concurrent-world safety is claimed.