Error "Condition ' pointcount < 3 ' is true." is appearing and have no idea why

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

Full error

0:00:00:0660 - Condition ' pointcount < 3 ' is true.
Time: 0:00:00:0660
C Error: Condition ' pointcount < 3 ' is true.
C Source: servers\visual\visual_server_canvas.cpp:664
C Function: VisualServerCanvas::canvas_item_add_polygon

That doesn’t tell me where it’s coming from in my code. Any ideas what can cause this?

My best guess is that you have a collision shape somewhere with fewer than 3 vertices while Visible Collision Shapes is enabled.

Beamer159 | 2018-02-16 20:24

Disabling visible collision shapes did make the error go away. Would this occur if I am using a 2D circle shape? I think that’s the only shape with less than 3 vertices.

jarlowrey | 2018-02-16 22:25

I couldn’t get the CircleShape2D to give this error. Either it worked correctly or I got a Bad Polygon error (with a radius of 0). The only shape I know how to generate the error for is ConvexShape2D since I have direct access to its vertices. I can’t seem to create the error for the other CollisionShape2D resources.

Beamer159 | 2018-02-16 23:37

Thanks for checking it out! What if you had an empty CollisionPolygon2D? My overall parent has this, but a child is using the Shape as a circle. So in my script I delete the CP2D on _ready, but maybe that’s where the error is coming from?

jarlowrey | 2018-02-17 14:34

:bust_in_silhouette: Reply From: jarlowrey

Issue was that I had Visible Collision Shapes on, and an empty Collision Polygon.