CollisionPolygon2D problems with one way collision

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pelli

Does anybody knows how can I make a single CollisionPolygon2D?
When I put a lot of dots, they divide into several colors, each color is like another collision shape, so each color passes through the one way collision, How can I made a single color CollisionPolygon2D?

Imgur
Imgur

Those colors are not individual collision shapes so theirs no problem.

Merlin1846 | 2020-05-03 15:20

:bust_in_silhouette: Reply From: njamster

The colors are merely indicating how the polygon is triangulated. It’s still one collision shape! That your polygon is falling through the floor has nothing to do with this, it is simply the effect of enabling the “One Way Collision”-property. Rotate the polygon by 180 degrees and it will no longer fall through the floor.

but if I rotate the polygon it wil be turned, and I don´t want that, If I make the polygon of 1 color the polygon don´t fall through the floor, but I need more triangulations

Pelli | 2020-05-03 17:12

but if I rotate the polygon it wil be turned

Only if your first create the polygon and then rotate it.

If I make the polygon of 1 color the polygon don´t fall through the floor

I cannot reproduce this, a simple triangle falls through the floor as well.

njamster | 2020-05-03 17:39

I rotated it, and it keeps happening. I do not understand, because this happens to me with a polygon, I can walk up and down the block that has the one way activated, but if I do it with a collisionshape or with a single color in the polygon, this does not happen, I can only walk up, as it should be. It’s like with the colors it gets stuck in the middle of the block, like in the second photo, you can move like if there were a second floor

Pelli | 2020-05-03 17:57

Can you upload your project somewhere and provide a link to it here? Otherwise, I’m afraid I cannot help you as things seem to work differently on my end.

njamster | 2020-05-03 18:00

This is not a code problem, this always happens in any project. If you create a kinematic with a polygon collision shape, and you have a block (static body for example) with one way collision activated, If you are on top of the block (as in the first photo), and you fall from the sides of the block, you get stuck (second photo) and when you are stuck, you can walk to the sides, as if it were a second floor of the block. All this does not happen with a collision shape, or a polygon shape of a single color, when you throw yourself by the sides, it just falls, it does not get stuck

Pelli | 2020-05-03 18:24

i never stated that it was a code problem. I merely asked if you can upload an example project as I cannot reproduce your issue on my end.

njamster | 2020-05-03 20:12

haha, So i don´t know how to share, but I tried something, This is an old sample that I have
https://drive.google.com/drive/folders/1rIzagMUw-U8uJlWnwgnr_uGy5bC-eJ3F?usp=sharing

play the scene with the collision enabled on depurator, and then go to the collision and jump on top of it, and then fall from the sides to the collision and you will get stuck ( and you will get stuck in every color of the polygon)

Pelli | 2020-05-03 21:53

While I’m not certain, I think you might have stumbled across a bug here, so consider creating an issue over at github. Switching the polygon’s build_mode-property from “Solids” to “Segments” seems to fix the issue, but somehow makes the character jittery when pushed into the ground by gravity (which might be another bug actually).

njamster | 2020-05-11 14:14

Thanks a lot for your time, I will report the bug

Pelli | 2020-05-11 18:18