-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
RayCast2D and CollisionPolygon2D collisions are unreliable #38873
Comments
CollisionPolygon2D decomposes into multiple ConvexShape2D shapes when in "solids" mode: godot/scene/2d/collision_polygon_2d.cpp Lines 49 to 59 in 00949f0
To determine whether a shape intersects a raycast,
Unfortunately, godot/servers/physics_2d/shape_2d_sw.cpp Line 559 in 00949f0
Probably such a check could be done after failing to intersect any of the lines using Edit: there might be faster ways to check for this, e.g. see https://stackoverflow.com/questions/1119627/how-to-test-if-a-point-is-inside-of-a-convex-polygon-in-2d-integer-coordinates |
Any workarounds? |
@knightofiam Area2D or KinematicBody2D and |
Still valid for v4.0.dev.custom_build [a0d800e] |
Godot version:
3.2.1
Issue description:
The Sprite becomes red when the raycast's
is_colliding()
returns true.As you can see, raycast will detect collision only with the edge of polygon's quad and will fail inside.
Minimal reproduction project:
ReproductionProject.zip
EDIT:
Also tested with rectangle CollisionShape2D and it works correctly, so it's indeed a bug with polygons.
The text was updated successfully, but these errors were encountered: