Skip to content
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

Very large 2d cuboid "ground" destabilizes simulation #629

Open
taslater opened this issue May 7, 2024 · 0 comments
Open

Very large 2d cuboid "ground" destabilizes simulation #629

taslater opened this issue May 7, 2024 · 0 comments

Comments

@taslater
Copy link

taslater commented May 7, 2024

A GROUND_WIDTH greater than or equal to about 1e8 causes the simulation to become unstable. Collisions with this very large "ground" seem to impart a large energy to the other collider, which increases as the "ground" is larger. Other times, the object colliding with the ground falls right through.

const PHYSICS_SCALE: f32 = 1e0;
const GROUND_WIDTH: f32 = 1e6;
const GROUND_HEIGHT: f32 = 10.0;

let ground_collider =
    ColliderBuilder::cuboid(GROUND_WIDTH * PHYSICS_SCALE, GROUND_HEIGHT * PHYSICS_SCALE)
        .translation(vector![GROUND_X * PHYSICS_SCALE, GROUND_Y * PHYSICS_SCALE])
        .restitution(GROUND_RESTITUTION)
        .collision_groups(InteractionGroups::new(0b0001.into(), 0b1111.into()))
        .build();

I'm not sure if this is expected behavior for the collision of objects of very different sizes, but I wanted to raise the issue to attention. I should also mention that the height of the cuboid does not seem to improve the stability of the simulated collisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant