Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | keke | |
Old Version | Published before Godot 3 was released. |
I would like to be able to write a function in a script for an object that would take a Vector2() point in local co-ordinates, and convert it to global. It should take into account the transform of the object (loc rot scale)
Example: If the object was at (3,3), rotated 45 degrees clockwise, and not scaled, an input of (0,-1) would return (3+cos(45), 3-sin(45)).
I’m not sure if understand, is like adding the vector to get_global_pos
of a Node2D?
eons | 2017-01-03 01:25
Nearly, but I want to account for rotation of the object too. I probably should have done an example WITH rotation…
keke | 2017-01-03 01:29
Something like:
get_global_pos()+my_vector.rotated(get_rot())
eons | 2017-01-03 02:07
Is there a way to account for scale?
keke | 2017-01-03 02:55
sorry for being unclear
keke | 2017-01-03 02:56