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

I have been using Godot engine for a year now, and I have often thought it is incompetent, and faulty.

Every single time, I have discovered that the engine is perfectly fine, and I have only myself to blame.

Except for now, this is my very first and only grievance. It is deeply incompetent, so I've filed an issue:

https://github.com/godotengine/godot-proposals/issues/777

in Engine by (12 points)

1 Answer

0 votes

Geometry.offset_polygon2d() inflates the shape, kinda confusing.

But what you want is a Transform2D. For example if you want to offset the polygon by 50px in the x and y direction you do something like this:

var polygon = PoolVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)])

var offset = Vector2(50, 50)
polygon = Transform2D(0, offset).xform(polygon)

print(polygon) # prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)]
by (22 points)
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.