Hello,
I just tried and successed to transform a position that was in world/global coordinates (from get_collider_point()) into object/local coordinates for one of my object.
I did not find the documentation straight away from a google search.
I needed to walk through the doc for some time before to realize that this part on matrices was trying to answer my question:
http://docs.godotengine.org/en/stable/tutorials/matrices_and_transforms.html
However, I found it a bit confusing as it is not clearly say that is about local/global or world/object coordinates.
At first, I thought that Matrix32 were a bit mysterious and I didn't see how to get them.
Unfortunately, there is no actual example!
I finally understood that the Matix32 of an object was given by the get_transform() function, and so I only needed to do:
var local_pos = get_transform().xform_inv(collision_point)
That is quite practical. But maybe that part of the doc could quickly mention a true world example with get_transform() ?
Alternatively, we could have a convenience function that transform from local to global and from global to local?
Convenience functions would be lovely but this part of the docs really needs an update.
I was stuck for the longest time on converting local to global and back.
now there are to_local and to_global methods which are used for that purpose
Most helpful comment
now there are to_local and to_global methods which are used for that purpose