Editor position VS World Position

Hi! I want to make few things clear…
I have object at the very top of my hierarchy, with coordinates like:

[-2.4, 2.0, -1.5] - in editor window

I assumed, those are object world coordinates, as it is at the very top? No parent and e.t.c

But, if I use this:

Debug.Log(“WP?:” + transform.TransformPoint(OBJ.transform.position));

Output is

[6.1, 3.8, 3.6]

So, why is the difference?

Because you are using TransformPoint. If you want the world coordinates, just do Debug.Log(transform.position).

–Eric

I’m sorry, my bad, seems like I explained it in a wrong way.
Here, I have very good example, of what exactly is wrong.

  1. I have GameObject, sitting at the top of hierarchy. Its transform.position is [3.324592, -0.2726327,1.804435]
  2. Now I parent it to some obj->obj->obj->obj->Our Current, and in expector, I can see now: [-0.1793798,0.0619714,0.00251963]
    So, I assume, inspector now shows object local coordinates.

But, object woorld position still stays the same: [3.324592, -0.2726327,1.804435]
How can I get it?
Ok, in Unity manual I read:
Transform.TransformPoint (Transforms position from local space to world space)

When I use this, I get wrong results. Ok, trial-and-error, I actually ended up using:

Transform.InverseTransformPoint

What the hell? So, after I reparented, inspector still showed world coordinates, but they changed? Oh, well, anyway. The edning result now is: [3.324593, -1.272633, 11.80443]
And why so now? X corrdinate transform back fine, but Y gets -1 extra, z +10 extra 0_0 While decimal part is all fine.

Sight, I wish I knew what is going on :slight_smile:

So, to summarize:
Transform.InverseTransformPoint shows me world coordinates for reparented object, but is broken?
Transform.TransformPoint does not translate local to world, or I assumed wrongly, that ispector shows objects local coordinates after we parent it to some hierarchy