-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 passing through tile when there is one cell between parallel tiles #37798
KinematicBody2D passing through tile when there is one cell between parallel tiles #37798
Comments
The issue here is that the Evidence that this is the issue: I reduced the More technical explanation: there is no such thing as a half-pixel, but sometimes math will spit out a non-whole number when doing physics calculations. The engine rounds that pixel the best it can, but part of the This is flirting with not being a bug, it's the engine working as intended when placed in edge-cases. I was playing around with animating collisions and I got myself stuck in a wall. That's not a bug -- it was a poor design choice on my part. I would recommend rethinking why you need the grids to be so pixel perfect to begin with and see if there isn't another way to solve the problem. If anyone else would like me to dig deeper into this (like where the pixel rounding is happening), I'd be willing to do so, but I don't think this edge case that I believe to be working correctly warrants more time. Thank's for submitting the bug @raphaklaus ! Let me know if I can help you further in this one. |
If we reduce the collision shape by 1 pixel and increase the safe-margin to 1 pixel, the issue doesn't happen. So it looks like they are handling the AABB differently for the safe-margin property. To be honest, I don't know if this behavior is on purpose or not, but it's confusing nevertheless. Edit: I am building a grid-based game. AFAIK, KinematicBody2D should handle normally this kind of games, I don't see a reason for the opposite. |
However, there is a difference between what is considered a collision when doing the binary search, and when extracting collision information. When extracting collision information, only penetrations deeper than the In addition, before testing whether a The problem arises when attempting to move into one of tiles when the |
@madmiraal I found what's seemingly a bug in Space2DSW::test_body_motion, though I'm not sure if it causes any actual problem. At the end of the for loop on line 1029 (on 3.2 head), there's a continue. I'm guessing it should be a break? Or maybe it's just there for debugging and it doesn't really do anything bad. |
@Srekel Actually, you do want it to continue, testing the other |
Godot version: 3.2.1
OS/device including version: Ubuntu 19.10
Issue description:
KinematicBody2D passes through Tilemap when tiles are just one space from another. Look at this gif:
That doesn't happen when there is more than 1 cell of space.
Steps to reproduce:
Minimal reproduction project:
https://github.com/raphaklaus/tilemap-godot-issue
The text was updated successfully, but these errors were encountered: