bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

Bump/stuck when walking on aligned colliders

Open SakiiCode opened this issue 10 months ago • 3 comments
trafficstars

I am prototyping a voxel game and walking on perfectly aligned cube colliders does not work properly

The capsule collider has a bump and the cylinder collider can't even go between blocks

Video (capsule collider)

Image

You can reproduce it with the stock dynamic_character_3d.rs by adding 3 static cubes

Code ```rust commands.spawn(( RigidBody::Static, Collider::cuboid(1.0, 1.0, 1.0), PbrBundle { mesh: meshes.add(Cuboid::default()), material: materials.add(Color::srgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(3.0, 0.0, 3.0), ..default() }, )); commands.spawn(( RigidBody::Static, Collider::cuboid(1.0, 1.0, 1.0), PbrBundle { mesh: meshes.add(Cuboid::default()), material: materials.add(Color::srgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(3.0, 0.0, 4.0), ..default() }, )); commands.spawn(( RigidBody::Static, Collider::cuboid(1.0, 1.0, 1.0), PbrBundle { mesh: meshes.add(Cuboid::default()), material: materials.add(Color::srgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(3.0, 0.0, 5.0), ..default() }, )); ```

Setting the NarrowPhaseConfig values to 0.0 seems to solve it but then I fall into or through the ground if I have high vertical velocity. (I guess that's expected)

.insert_resource(NarrowPhaseConfig {
    contact_tolerance: 0.0,
    default_speculative_margin: 0.0,
    ..Default::default()
})

SakiiCode avatar Jan 23 '25 22:01 SakiiCode