|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
AriWD40 |
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:
system
2
|
|
|
|
Reply From: |
SanderVanhove |
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)]