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

move_and_slide causes unexpected slide on edge of fast moving platforms #42765

Closed
Tracked by #45334
timothyqiu opened this issue Oct 13, 2020 · 4 comments · Fixed by #50314
Closed
Tracked by #45334

move_and_slide causes unexpected slide on edge of fast moving platforms #42765

timothyqiu opened this issue Oct 13, 2020 · 4 comments · Fixed by #50314

Comments

@timothyqiu
Copy link
Member

timothyqiu commented Oct 13, 2020

Godot version: 3.2.3 official & 4.0 (a392aa4)

OS/device including version: macOS 10.15.7 (not related to graphics)

Issue description:

move_and_slide makes KinematicBody2D slide horizontally on a up-moving platform if the KinematicBody2D is on the edge and the platform is moving fast enough.

demo

In the demo project, only a downward velocity (gravity) is applied to the player. The platform is a KinematicBody2D with sync_to_physics turned on and is moved by an AnimationPlayer. move_and_slide makes the player move right when elevating.

  • The MRP is using move_and_slide_with_snap, but move_and_slide behaves the same.
  • The MRP is made using 3.2.3. In 4.0, the slow platform speed have to be halved, i.e. the safe speed in 3.2 is bad in 4.0.
  • Something I don't understand: If you run the MRP, the player slides off the platform immediately on start. But after clicking "Reset" to reload_current_scene, it stays on the platform by default.

I tried some pending PRs fixing issues related to move_and_slide*, but they didn't fix this issue. (Issue #28895 seems similar, but its PR fix does not fix this issue.)

Steps to reproduce:
Use the MRP, and turn on "Fast Platform".

Minimal reproduction project:
SlideOff.zip

@Sslaxx
Copy link

Sslaxx commented Oct 13, 2020

Are you saying that the same bug happens at a lower speed in current 4.0 builds?

@timothyqiu
Copy link
Member Author

Yes.

If I run the MRP with 3.2.3, the bug happens if the platform is moving at 256 pixels per second, but not at 128 pixels per second.

In current 4.0 builds, the bug happens at 128 pixels per second too, but not 64 pixels per second.

@madmiraal
Copy link
Contributor

Related to #28895 and #43014. At high speed and when close to the edge, the collision normal returned is the normal of the side, not the top of the CollisionShape; so the object is being pushed to the side during the "unsticking" phase of test_body_motion().

@RPicster
Copy link
Contributor

I have the same problem in my game and it's beyond frustrating.
The problem also occurs when the platform is moving sideways.

Everything is set to use pyhsics frame (Animation Player too) so shouldn't the player keep standing on the platform irregardless of the speed? There is no "drag" defined. It should stay rock solid.

This is deadly for creating platformers that require tight controls.

SlideOff_side.zip

If there is a workaround, please share it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants