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

fix: character controller: walls less likely to trigger ground detection #655

Merged

Conversation

Vrixyz
Copy link
Contributor

@Vrixyz Vrixyz commented Jun 16, 2024

Context

While trying out dimforge/bevy_rapier#476 ; I noticed I could jump when hitting walls (particularly on the junction of 2 walls).

Bug analysis

When printing the normal dot value, I had this value in air: 1.7037166e-5 (hitting a wall perfectly perpendicular)

The current epsilon being 1.0e-5 ; this dot check is true, then is_grounded is true, and the character can jump in the example from dimforge/bevy_rapier#476.

Solution decription

I think it makes sense to relax this epsilon ; alternatively we could:

  • reuse the slope authorized for the character
  • or really pump that value, and/or normalize it
  • make it configurable

But that first fix is probably an easy sufficient fix ?

I'm wondering if this has anything to do with scaled transforms ?

@Vrixyz Vrixyz changed the title fix: walls less likely to trigger ground detection fix: character controller: walls less likely to trigger ground detection Jun 16, 2024
@Vrixyz Vrixyz requested a review from sebcrozet June 17, 2024 07:45
@sebcrozet
Copy link
Member

sebcrozet commented Jun 17, 2024

For the record, bumping the epsilon to 1.0e-3 means that for the controller to be grounded, the angle between the contact normal and the up vector has to be smaller than 89.9427042 degrees (instead of 89.999427 when the epsilon was 1.0e-5). That sounds reasonable.

@Vrixyz Vrixyz merged commit 84b66d6 into dimforge:master Jun 17, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants