-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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_collide returns inconsistent values #59139
Comments
Can you test this on 3.4.3? This may have been fixed since 3.4 was released. |
Checked in 3.4.3 - no change. |
I think the issue may not be on move_and_collide. I replaced the TileMap with a StaticBody2D with a few SegmentShape2D to mimic the collisions of the TileMap. In this new situation, the player behaves as expected, which means the inconsistency problem could be on TileMap-generated CollisionShapes. I could also be totally wrong - I don't have deep knowledge on Godot physics. Now, this may be off-topic, but I think there is a misunderstanding on what should be expected behavior. OP said that point 2 mostly works correctly, but I believe the only point that shows correct behavior is 1. According to the docs on move_and_collide:
Since the Player's body touches the sides of the platform, it should show collision information, which only happens consistently on point 1. To me, point 2 is actually the most borked, since it never seems to touch the Player. Maybe there's some weird floating point error. Also, note: move_and_collide requires its "velocity" to be multiplied by delta (the one from physics_process). However, mutiplying by delta doesn't help with this issue. Finally: if you wish to test only for collisions along a specific path, and not care about unrelated contacts, you should try the
|
Godot version
3.4.stable
System information
Windows 10, GLES3
Issue description
I'm using move_and_collide with test_only = true to check if the player is on the ground. After updating to 3.4, it sometimes detects a collision when the player is next to a collision shape and moving straight down (tested with solid tiles and CollisionShape2D with different shapes).
Steps to reproduce
Run minimal example and jump while standing directly next to the platforms. The behaviour is different for each numbered location:
1 - always sticks
2 - mostly works correctly (sometimes sticks for a brief moment when colliding from above at an angle, but this is somewhat difficult to trigger)
3 - sticks only if direction towards platform is held
4 - sticks until landing if direction towards platform is tapped
Minimal reproduction project
collision_test.zip
The text was updated successfully, but these errors were encountered: