Using HalfSpace collider shape in rapier3d-f64 (on a fixed rigid body) leads to three nested loops, each covering range of i32::MIN .. i32::MAX in the broad phase collision detection (of the first physics timestep) here:
|
let start = super::point_key(aabb_to_discretize.mins, self.region_width); |
|
let end = super::point_key(aabb_to_discretize.maxs, self.region_width); |
|
|
|
// Discretize the aabb. |
|
#[cfg(feature = "dim2")] |
|
let k_range = 0..1; |
|
#[cfg(feature = "dim3")] |
|
let k_range = start.z..=end.z; |
|
|
|
for i in start.x..=end.x { |
|
for j in start.y..=end.y { |
|
for _k in k_range.clone() { |
Halfspace collider shape AABB half extents are always 0.5 * Real::MAX, and thus the start and end variables in the above referenced lines end up equaling Point<i32>::min_value() and Point<i32>::max_value() with halfspaces.
The issue can seemingly be fixed by changing the constant in
|
pub(crate) const SENTINEL_VALUE: Real = Real::MAX; |
to
pub(crate) const SENTINEL_VALUE: Real = f32::MAX as Real;
but I am unsure about potential unwanted possible side-effects of the change in other use cases and if better approaches to fix the issue exist. More educated thoughts on the fix would be most welcome!
Using
HalfSpacecollider shape in rapier3d-f64 (on a fixed rigid body) leads to three nested loops, each covering range ofi32::MIN .. i32::MAXin the broad phase collision detection (of the first physics timestep) here:rapier/src/geometry/broad_phase_multi_sap/sap_layer.rs
Lines 223 to 234 in 053cb22
Halfspace collider shape AABB half extents are always
0.5 * Real::MAX, and thus thestartandendvariables in the above referenced lines end up equalingPoint<i32>::min_value()andPoint<i32>::max_value()with halfspaces.The issue can seemingly be fixed by changing the constant in
rapier/src/geometry/broad_phase_multi_sap/sap_utils.rs
Line 6 in aaf80bf
to
but I am unsure about potential unwanted possible side-effects of the change in other use cases and if better approaches to fix the issue exist. More educated thoughts on the fix would be most welcome!