bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

Issue: Incorrect inelastic collision

Open Badgerup1510 opened this issue 1 year ago • 5 comments

Currently trying to make a 3d first person character. i have given the entity with the collider a restitution of 0.0. Although this does not work, the player character still bounces upon reaching sufficient height and falling. I have attempted to apply a restitution of 0.0 too the ground as well with no avail. This is the current code: // Spawn the parent entity with the collider let parent = commands.spawn(( TransformBundle::from_transform(Transform::from_xyz(0.0, 4.5, 0.0)), RigidBody::Dynamic, Collider::capsule(1.0, 3.0), LockedAxes::new().lock_rotation_x().lock_rotation_z(), Restitution::new(1.0).with_combine_rule(CoefficientCombine::Min), Player, )).id();

for clarity o tried with and without the comibine rule.

Badgerup1510 avatar Nov 17 '24 20:11 Badgerup1510

I'm seeing this too / would love a way to prevent bouncing rigidbodies.

cart avatar Nov 24 '24 01:11 cart

Is this in version 0.1? I suspect this was fixed by #542 on the main branch. You can also see the second video there for a scenario that is quite similar to what you're describing; a cuboid with locked rotation and zero restitution falling to the ground.

Zero restitution is also the default on the main branch as of #551, so there shouldn't be any noticeable bounce by default anymore.

The bug was related to contact tangent directions being computed incorrectly for friction impulses, which was sometimes causing an upward force when hitting the ground. If this is the issue you're hitting, setting friction to zero should remove the bounce (not needed on main branch).

Jondolf avatar Nov 25 '24 00:11 Jondolf

Excellent! This is on my fork of your bevy-0.15 branch, adjusted to point to bevyengine/main. It doesn't contain those changes. I'll give it a test as soon as main (or some other branch) is updated to 0.15.

cart avatar Nov 25 '24 22:11 cart

(no time pressure on that. happy to wait until after Bevy 0.15 releases as I'm focused on that at the moment anyway :smile: )

cart avatar Nov 25 '24 22:11 cart

The main branch already uses Bevy 0.15-rc, but not Bevy's main branch. My new PR for interpolation and extrapolation support (#566) does depend on Bevy's main branch though, since it needs a bug fix that hasn't made it into an RC yet (one of the recently merged fixes to runtime required components)

Edit: The main branch uses Bevy 0.15 now. A new release is also coming Soon™.

Jondolf avatar Nov 25 '24 22:11 Jondolf