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

KinematicBody3D with move_and_slide() does unreliable is_on_floor() detection when nearly on platform's edge #45219

Closed
archerallstars opened this issue Jan 15, 2021 · 6 comments

Comments

@archerallstars
Copy link

Godot version:

  • Godot 3.2.4 beta 5

OS/device including version:

  • Windows 10 Home 64-bit, Version 20H2, OS build 19042.746
  • Intel® UHD Graphics 620, Version 27.20.100.9126

Issue description:

Since GodotPhysics has an issue #45060 that causes the KinematicBody3D to move bumpy/jittering on a flat surface, as a solution, I put the is_on_floor() condition to only apply the gravity when the body is not on the floor.

However, when the body is nearly on the edge of the platform, the is_on_floor() flickeringly returns true and false even though the body is always on the floor, as shown in the screen recording below (from 0:17 onward):

2021-01-15.16-44-38.mp4

Steps to reproduce:

  1. Open the reproduction project.
  2. Run the scene.
  3. See the print results in the output window.

Minimal reproduction project:

test.zip

@archerallstars
Copy link
Author

archerallstars commented Jan 16, 2021

For anyone who's still finding a way to work around this bug, you can use the RayCast node instead. My working setup as shown below:

Screenshot 2021-01-16 001441

@pouleyKetchoupp
Copy link
Contributor

Confirmed in 3.2.4 beta 6.
Godot Physics: is_on_floor becomes inconsistent near the end of the platform.
Bullet: is_on_floor is inconsistent all along and the body jitters.

@Sv1nnet
Copy link

Sv1nnet commented Feb 6, 2021

Btw I noticed that C# script handles IsOnFloor more correctly than GDScript.
Here are 2 project in C# and GDScript that demonstrate the different result of the same movement logic.

Godot version:

  • v3.2.4.beta6.mono.official
  1. Just move any player along the whole ground - in C# IsOnFloor detects the floor correctly, but GDScript doesn't;
  2. But then move a player between blocks;
  3. Let him just stand there;
  4. Have the second player standing on another one and you see that IsOnFloor doesn't work correctly in both C# and GDScript;

C# - IsOnFloor_bug_cs.zip
GDScript - IsOnFloor_bug_gdscript.zip

@pouleyKetchoupp
Copy link
Contributor

In 3.3.2, I can't reproduce this issue with Godot Physics (tested with the original MRP and in 2D with the test from #45219 (comment)).

Please confirm so this issue can be marked as Bullet-only.

@archerallstars
Copy link
Author

In 3.3.2, I can't reproduce this issue with Godot Physics (tested with the original MRP and in 2D with the test from #45219 (comment)).

Please confirm so this issue can be marked as Bullet-only.

I also can't reproduce this issue in 3.3.2 as shown in the screen recording below:

2.mp4

@pouleyKetchoupp pouleyKetchoupp changed the title [GodotPhysics] KinematicBody3D with move_and_slide() does unreliable is_on_floor() detection when nearly on platform's edge [Bullet] KinematicBody3D with move_and_slide() does unreliable is_on_floor() detection when nearly on platform's edge Jun 25, 2021
@akien-mga
Copy link
Member

So it seems the GodotPhysics bug was fixed in 3.3.2 or earlier (maybe 3.3).

The Bullet specific issue is a duplicate of #45058.

@akien-mga akien-mga changed the title [Bullet] KinematicBody3D with move_and_slide() does unreliable is_on_floor() detection when nearly on platform's edge [Bullet] May 19, 2022
@akien-mga akien-mga changed the title [Bullet] KinematicBody3D with move_and_slide() does unreliable is_on_floor() detection when nearly on platform's edge May 19, 2022
@akien-mga akien-mga added this to the 3.3 milestone May 19, 2022
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