Are there coordinates that don't change even if the object moves?

Is it possible to somehow have coordinates that will spawn an object at the same position on the object that I am spawning it onto even if that object moves somewhere in the world?

If the mark is a child of the map, the localPosition of the mark will not change when the map moves

Right. A Transform’s position can be thought of in two different ways:

  • Its position in the world. If its parent moves, this changes. This is position.
  • Its position relative to its parent. If its parent moves (or rotates, or scales), this doesn’t change. This is localPosition.

Similarly, a Transform has both a world rotation (rotation) and a local rotation (localRotation). You also have a “world scale” (lossyScale) and a local scale (localScale), but the former is read-only.

I believe this is a consequence of how weird non-uniform scaling is. You’ve probably seen this if you’ve ever tried rotating a non-uniformly scaled object; its children get all skewed and warped.

1 Like

Just make a new GameObject() and store all the info there (in its Transform Component), keeping a reference to it.

Empty GameObjects are invisible and irrelevant except to things that keep track of them, in this case your object that might move around.

When you need to go back to that position, use the transform.position (and possibly transform.rotation) of that GameObject.