|
|
|
|
Reply From: |
kidscancode |
You can’t iterate a CollisionPolygon2D, which is what the col_polygon
variable is equal to after the get_node()
.
I think you want the object’s polygon, which would be:
var col_polygon = get_node("object" + str(clicks)).get_node("CollisionPolygon2D").polygon
The polygon
property returns a PoolVector2Array
which you can iterate.
See CollisionPolygon2D for details.
Oh yes, thats right… thank you… also, do you know what means “convex partition failed”. I get this message sometimes in the output and the navigation messes up
After searching through Godot’s code, i found this
TriangulatorPartition tpart;
if (tpart.ConvexPartition_HM(&in_poly, &out_poly) == 0) { //failed!
print_line("convex partition failed!");
return;
}
I have no idea about what this could mean…
GunPoint | 2018-02-25 20:37
and BTW, in Godot 3 its get_node("CollisionPolygon2D").get_polygon()
instead of just polygon
GunPoint | 2018-02-25 20:44
“convex partition failed” means the engine is having trouble partitioning your polygon. It could mean one of the vertices is badly placed.
kidscancode | 2018-02-25 22:07
Huh, weird… i use 3.0 stable, when i do get_polygon()
it works, when i do polygon
it crashes
GunPoint | 2018-02-26 14:11
Do you get an error when it crashes? Those should be equivalent.
kidscancode | 2018-02-26 16:46
Oh, no something else has caused the game to crash… my bad
GunPoint | 2018-02-26 18:22
And i really don’t know why i get the “convex partition failed” message. All vertices are in the right place, im sure about that (i use pixel snap). It messes up the navigation and i dont know why! The first collision the player touches works normal, but then i get this message and it basically deletes other collision polygons…
Thats what the console says:
ERROR: SelfList::List::~List: Condition ’ _first != 0 ’ is true.
At: c:\projects\godot-builds\godot\core\self_list.h:100
convex partition failed!
GunPoint | 2018-02-26 18:28