World To Local Transformation


I’m playing around with the transformation component to figure the basic stuff out…

There is a parent object at position [0,0,1] and a child at [0,0,1] (relativ to parent).
I want to move the child regardless of its hierarchy to world position [0,0,0]. As far as I understand, I need to get the new local space position because Entity.Transform.Position are local space coordinates.

To do so, I use Entity.Transform.WorldToLocal(Vector3.Zero) to get the new position, relative to its parent. But the result is [0,0,-2]. That are the values, I have to use to move the object to the destination. I expect the values [0,0,-1] as local space point as the world origin because of the documentation of WorldToLocal.

I don’t know whats wrong here…

Thanks for the help.

Which entity is that? It should be the parent, because you want a coordinate relative to the parent.

If you use the child entity, you get coordinates relative to the childs currently position.