I’d like to ask how the inverseTransformPoint works.
Suppose I have a gameobject with position (33.0, 25.0, 20.0) and the same orientation w.r.t world coordinates (with the scale 1).
Then, the position of world coordinates w.r.t to the local coordinates of my gameobject would be (-33.0, -25.0,-20.0).
But, when I do the InverseTransformPoint to the position of my gameObject, the position of World to local are totally different from World To Local Matrix.
does anyone know what is the difference?
Thanks in advance
You’re probably using the matrix incorrectly. But figure the correct value, and see who’s wrong and right.
Take your object p1 at (33,25,20). For simplicity, keep it “unspun” facing +Z. If you have point p2 at z+1 – (33,25,21) – then InvTransPoint should give you (0,0,1). Just to be clear, it’s saying that p2 is one unit in front of p1. If you spin p1 to face right, then InvTransPoint should give you (-1,0,0). Again, to be clear, it’s now saying that p2 is just to p1’s left.
Try it again with the worldToLocal matrix. Should give the same numbers.