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

Player gets "stuck" on walls if colliding with enough velocity while jumping upwards #75

Open
Gabeperson opened this issue Dec 28, 2024 · 1 comment

Comments

@Gabeperson
Copy link

When player has enough horizontal velocity, and collides into a wall while traveling upwards in a jump, holding the same direction continuously allows you to get "stuck" on the wall, not falling down.

I've reproduced this in the platformer_2d demo and the platformer_3d with both the avian and rapier backends for each, with only changing one line in the demos/src/levels_setup/for_2d_platformer.rs and demos/src/levels_setup/for_3d_platformer.rs files to make the appropriate box large enough for the repro.

helper.spawn_rectangle(
  "Box to Step on",
  css::GRAY,
  Transform::from_xyz(-4.0, 1.0, 0.0),
  Vector2::new(4.0, 2.0),
);

to

helper.spawn_rectangle(
  "Box to Step on",
  css::GRAY,
  Transform::from_xyz(-4.0, 1.0, 0.0),
  Vector2::new(4.0, 6.0), // Only thing that changed (equivalent for 3d as well)
);

Video showing what I mean:
(The red and green rectangles is a simple gizmo system so that you can see the key presses needed to reproduce. They correspond to space bar and arrow keys. I've made no other functional changes to the demo other than this)

repro.mp4

The repro was done on main branch, with commit hash 3be4684

You can see how the player gets "stuck" on the wall and doesn't fall until I release the left arrow key.

I could not reproduce the issue when setting the friction between the player and the wall to 0, so it may be related to friction?

@idanarye
Copy link
Owner

I don't really have a good way to solve this on my side. Being able to move midair means being able to apply force/acceleration midair, but when you do that against a wall, the friction with the wall prevents the character from falling down.

Easiest way to solve this is to set the character's friction to 0.

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

2 participants