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

Friction impulse not applied at contact point with additional_mass #666

Open
andrewbaxter opened this issue Jun 24, 2024 · 1 comment
Open
Assignees
Labels

Comments

@andrewbaxter
Copy link

In this example:

    let ground_height = 0.1;
    colliders.insert_with_parent(
        ColliderBuilder::cuboid(100.1, ground_height, 100.1).friction(0.5),
        bodies.insert(RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0])),
        &mut bodies,
    );
    colliders.insert_with_parent(
        ColliderBuilder::cuboid(0.2, 5., 1.5).friction(0.5).mass(0.),
        bodies.insert(
            RigidBodyBuilder::dynamic()
                .additional_mass(0.5)
                .translation(vector![-10., 6.0, 0.0])
                .linvel(vector![20., 0., 0.])
                .can_sleep(false),
        ),
        &mut bodies,
    );

A tall, narrow cuboid moving quickly horizontally falls onto the ground. If the collider has mass and the rigid body doen't, when the cuboid contacts the ground it starts toppling over as the top maintains momentum but the bottom near the contact point slows down. When adding the mass to the rigid body instead of the collider the body simply slides along the ground without tipping over.

This is unexpected, and I can't think of any reason why this behavior would be intentional. If it is intentional though, it'd be good to have visible documentation. I looked in the Friction section first, because I thought maybe there was some parameter about how friction forces are applied (at body center or at point of contact).

@Vrixyz
Copy link
Contributor

Vrixyz commented Jul 17, 2024

Reproduction code: Vrixyz#1

With collider mass at 0.5 and rigidbody additional mass at 0.0, here is the current behaviour, which is expected:

collider_fall_ok.mp4

With collider mass at 0.0 and rigidbody additional mass at 0.5, here is the current behaviour, which is unexpected:

unexpected_not_fallen.mp4

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

No branches or pull requests

3 participants