Godot: CollisionPolygon2D fall through with One Way Collision enabled

Created on 9 Feb 2019  路  7Comments  路  Source: godotengine/godot

Godot version: Godot 3.1 Beta 3

OS/device including version: Windows 10

Issue description:

polygoncollision

Steps to reproduce:
Seems to happen only when the body with polygon is moving upwards

Minimal reproduction project:

OneWayPolygonCollision.zip

bug confirmed physics

Most helpful comment

Sorry, I quit programming, I'll go open a farm.

All 7 comments

Sorry, I quit programming, I'll go open a farm.

This doesn't seem like CollisionPolygon2D exclusive. A RigidBody2D character can go through a rectangle StaticBody2D wall at times. This is more like a universal bug with One Way Collision.

I just ran into this same issue. In my case I have a capsule-shaped KinematicBody2D (player) falling through a segment-shaped StaticBody2D. Out of the following 5 segments, it only occurs with the one marked X:
image

That one is at y=130, and if I remove it and place another identical platform at that coordinate, the player falls through again. So it seems to be tied to the position. If I set its "One Way Collision Margin" to 1.4 or higher, then the player won't fall through but will instead rapidly vibrate up and down by 1 pixel while standing on it, so unfortunately that's not a solution.

(Using 3.1.1 stable)

I've had some luck by manually replicating this:
https://github.com/godotengine/godot/blob/24e1039eb6fe32115e8d1a62a84965e9be19a2ed/scene/2d/collision_polygon_2d.cpp#L49-L59

So.. in my case I have a "terrain" which I was trying to apply ConcavePolygonShape2D and ConvexPolygonShape2D to without success. This terrain is an array of points (defining the heightmap) rendered using draw_polyline.
What I am doing now is looping over all the points from zero to length-1 and creating individual convex triangles for each i, i+1 and a "bottom" vector2.

This seems to have fixed it for mel it's made all my terrain edges "solid".

For the reference, the project in OP no longer reproduces the issue, as it was fixed by cb09abdbbdb.

The project in https://github.com/godotengine/godot/issues/25732#issuecomment-466669002 still reproduces the issue in the current master branch.

I can confirm #42574 fixes the issue (broken in 3.2.3.stable)
https://github.com/godotengine/godot/issues/25732#issuecomment-466669002
in the 3.2 branch.

Was this page helpful?
0 / 5 - 0 ratings