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

Character does small "midair jump" when it tries to jump over a platform and comes a little short #14

Closed
idanarye opened this issue Apr 12, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@idanarye
Copy link
Owner

This is from my game, Gardening Gun, which uses Tnua (I've edited the level a bit so that the character will only interact with a single collider):

Peek.2023-04-12.23-40.mp4

The character is not supposed to be able to do that extra airjump to get on top of the platform.

@idanarye idanarye added the bug Something isn't working label Apr 12, 2023
@idanarye
Copy link
Owner Author

This replicates in the 3D example:

Peek.2023-04-16.16-23.mp4

And when I add debug rendering:

Peek.2023-04-16.16-26.mp4

WTF?

@idanarye
Copy link
Owner Author

This definitely has something to do with the sensor shape. When I reduce the flat-underfit radius from 0.49 to 0.4 I get a much smaller climb effect:

Peek.2023-04-16.16-57.mp4

Whereas with radius 0.3 I get no climb effect at all.

@idanarye
Copy link
Owner Author

Thinking that maybe the Rapier transforms were not synchronized with the Bevy transforms when I perform the cast, I tried adding this to update_proximity_sensors_system:

if let Some(rigid_body) = rapier_context.entity2body().get(&owner_entity).and_then(|h| rapier_context.bodies.get(*h)) {
    let rigid_body_translation = Vec3::from_slice(rigid_body.translation().as_slice());
    assert_eq!(rigid_body_translation, transform.translation());
}
if let Some(collider) = rapier_context.entity2collider().get(&owner_entity).and_then(|h| rapier_context.colliders.get(*h)) {
    let collider_translation = Vec3::from_slice(collider.translation().as_slice());
    assert_eq!(collider_translation, transform.translation());
}

But it did not panic.

@idanarye
Copy link
Owner Author

It looks like the character's collider gets pushed a bit into the other collider, which breaks stuff. To solve this, I'm going to have to check for contacts when filtering the entities.

idanarye added a commit that referenced this issue Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant