This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi all,

(Hopefully) simple question: How do i merge 2 overlapping polygon points?

enter image description here enter image description here

As you can see, The Polygons in the middle are overlapping (100%). I want to merge those, so then if i drag them, both images/textures will be affected at the same time.

I´ve tried the Geometry Singleton with its merge_polygons function:
enter image description here

But there is a problem. The polygon attribute does not give the position, but their coordinates in the UV map (i think).

So, do you know any other way of achieving this? Thanks!

Godot version Godot 4 Beta 15
in Engine by (78 points)

How were those polygons created? The vertex data assigned to a polygon can define the shape anywhere in space (simply via the coordinates). However, it's also possible to create the vertex data based at some origin (likely 0,0) and then move the shape in space via either the offset property or the underlying transform's position. Since your polygon data appears to be origin-based, I'd guess the positions are controlled by the vector found in one of the mentioned properties.

I'd assume you could add the appropriate vector value to each of the vertices and then use those modified vertices in the call to merge_polygons(). Assuming that works, you'd likely need to subtract that vector from the resulting merged polygon vertices when done.

That said, I'm really just guessing here... :)

Hi, these Polygons were created simply by creating a Polygon2D Node and using the in-editor polygon tools.

However i actually managed a workaround, where i just move all 4 overlapping points at the same time. Not the most optimal but it works for now!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.