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

KinematicBody2D: odd move_and_slide behaviour when exactly on tile edge #44882

Open
Tracked by #45334
snoopdouglas opened this issue Jan 2, 2021 · 4 comments
Open
Tracked by #45334

Comments

@snoopdouglas
Copy link
Contributor

snoopdouglas commented Jan 2, 2021

Godot version:
3.2.3-official

OS/device including version:
Ubuntu Linux 20.04

Issue description:
Possibly related to #33833.

When using KinematicBody2D's move_and_slide or move_and_slide_with_snap to enact gravity, I've noticed that when a body is exactly on the diagonal edge of a tile:

  • is_on_floor() returns false
  • is_on_wall() returns true
  • The body can't travel any further, but keeps gaining velocity (when setting it from the result of move_and_slide)

So we essentially end up with a Mario 64 speedrunner's dream:

Screenshot from 2021-01-02 23-31-42

Interestingly, the value of y tends to fluctuate, and sometimes (seemingly non-deterministically) the body unhooks itself and so goes flying downwards.

Steps to reproduce:

  • Position a KinematicBody2D on the edge of a tile
  • Apply gravity to it
  • Note the weird behaviour of its position and velocity

Minimal reproduction project:
floor-wall-test.zip

@madmiraal
Copy link
Contributor

Related to #43012 and #43014.

@snoopdouglas
Copy link
Contributor Author

snoopdouglas commented Jan 28, 2021

I've reproduced this in 3.2.4-rc1.

Edit: still reproducible in 3.3.4

@pouleyKetchoupp
Copy link
Contributor

Confirmed still present in 3.4 beta 6 and master (6877ccc).

@MaxMarauder
Copy link

I can confirm that the issue is still reproducible in v3.5.3.stable.official.

Here's a workaround I used:

    if is_on_wall() && is_equal_approx(position.x, round(position.x)):
        position.x += 0.001

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

No branches or pull requests

5 participants