Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MangoTree |
Hi,
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?
Thanks
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 Input.is _ key _ pressed(KEY _ RIGHT):
rotation_degrees+=0.5
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