How do I reference Geometry2D in GDExtension?

Godot Version



What is the correct way to reference geometry2D?

I tried this:
Ref<Geometry2D> geometry2D(memnew(Geometry2D));
And then get this error when compiling: ‘unreference’: is not a member of ‘godot::Geometry2D’

I tried this:
PackedInt32Array tri_ids = Geometry2D::triangulate_polygon(intersect_polygons2D[k]);
I get this error: a nonstatic member reference must be relative to a specific object

I tried this and got memory leak:
Geometry2D geometry2D;

It’s a singleton, so you use Geometry2D::get_singleton()->triangulate_polygon(intersect_polygons2D[k])

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.