Line2D coordinates not updating after rotation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MangoTree


It looks like the coordinates of Line2D (accessed through get_point_position(int)) do not update after the Line2D node is rotated by an angle. The coordinate values printed to the console remain unchanged as the line rotates. Does anybody know if there is a fix/work around for this?


Perhaps you can show us some of the code you use to rotate the Line2D? That’ll help to clarify the problem.

Ertain | 2019-02-28 21:15

The local coordinates don’t change if you change the transform (i.e. rotate).
Read here about how to convert local to “global” coordinates. (see xform):
Matrices and transforms — Godot Engine (3.0) documentation in English

wombatstampede | 2019-02-28 21:53

Hi, if you run this on a Line2D, it should print the same value (provided you press the right arrow key), even though I would have expected it to change:

func _process(delta):

  • if _ key _ pressed(KEY _ RIGHT):
	print(get _ point _ position(0))

Apologies for the incorrect formatting - I’m new to posting on this forum

MangoTree | 2019-02-28 23:11

Hi, thanks for your reply. Using global _ transform.basis _ xform(get _ point _ position(int)) looks like it solves my issue.

MangoTree | 2019-02-28 23:14

:bust_in_silhouette: Reply From: MangoTree

Using ‘global _ transform.basis _ xform(get _ point _ position(int))’ solves the problem I was encountering (it now shows the updated point coordinate after the ‘Line2D’ node goes through a rotation). Thanks to all for the replies.