-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Far away object causes panic in broad phase #77
Comments
We started running into this as well and agree. Some more information regarding what might be causing it would be super helpful. |
I've written an example to reproduce this issue. use rapier3d_f64::dynamics::*;
use rapier3d_f64::geometry::*;
use rapier3d_f64::pipeline::*;
use rapier3d_f64::math::*;
pub struct DummyEventHandler;
impl EventHandler for DummyEventHandler {
fn handle_intersection_event(&self, _: IntersectionEvent) {
}
fn handle_contact_event(&self, _: ContactEvent) {
}
}
fn main() {
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut joints = JointSet::new();
let mut pipeline = PhysicsPipeline::new();
let mut broad_phase = BroadPhase::new();
let mut narrow_phase = NarrowPhase::new();
let integration_params = IntegrationParameters::default();
let rigid_body = RigidBodyBuilder::new_dynamic().position(Isometry::translation(0.0, 5.0e10, 0.0));
let rigid_body = bodies.insert(rigid_body.build());
colliders.insert(ColliderBuilder::ball(1.0).build(), rigid_body, &mut bodies);
pipeline.step(
&Vector::zeros(),
&integration_params,
&mut broad_phase,
&mut narrow_phase,
&mut bodies,
&mut colliders,
&mut joints,
None,
None,
&DummyEventHandler
);
} |
After digging through the source code, I've identified the issue. When creating keys for the region hash map in the broad phase we hit fn point_key(point: Point<Real>) -> Point<i32> {
(point / CELL_WIDTH).coords.map(|e| e.floor() as i32).into()
} When I think it's worth at least making the key a |
@aristaeus Thank you for looking into this in details.
Yes, using Users will still encounter this issue in the future (at least with the |
Those assertions also trigger when a NaN slips into the simulation. In my case, setting a Collider's density to 0.0 caused the proxy.aabb.min and max to have -4.49423e308 as value (the negative value of a constant with special meaning in the code). |
I just ran into this yesterday setting a NaN velocity due to doing something like |
Can confirm this crash, when a rigid body gets too far away, affects the |
So rather than crashing, can we switch to |
This can happen when an object is free falling without a floor.
If the panic is intentional it should be documented under what conditions it can occur and what users can do to prevent it.
The text was updated successfully, but these errors were encountered: