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

Collisions do not work when the Collider is inside the hollow ring #561

Open
shenopkss opened this issue Nov 18, 2024 · 0 comments
Open

Comments

@shenopkss
Copy link

I'm experiencing an issue where collisions do not work when a Collider is inside a hollow ring. The dynamic rigid body passes through the hollow ring without detecting any collision. I hope someone can help me, thank you very much!

Here is the code demonstrating the issue:

commands.spawn((
    RigidBody::Dynamic,
    Collider::circle(radius),
    MaterialMesh2dBundle {
        mesh: Mesh2dHandle(meshes.add(Circle { radius })),
        material: materials.add(color),
        transform: Transform::from_xyz(0.0, 0.0, 0.0),
        ..default()
    },
));

let outer_radius = 50.0;
let inner_radius = 40.0;

let shapes = vec![
    (Isometry::identity(), SharedShape::ball(outer_radius)),
    (Isometry::identity(), SharedShape::ball(inner_radius)),
];

let hollow_ring = SharedShape::compound(shapes);

commands.spawn((
    RigidBody::Static,
    Collider::from(hollow_ring),
    MaterialMesh2dBundle {
        material: materials.add(color),
        transform: Transform::from_xyz(0.0, 0.0, 0.0),
        ..default()
    },
));

Expected Behavior:

The dynamic collider should detect collisions with the hollow ring and not pass through it.

Actual Behavior:

Collisions are not detected when the collider is inside the hollow ring.

Additional Information:

Any insights or solutions to this issue would be greatly appreciated!

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