# localToGlobal() and its evil cousin

**URL:** <https://forum.kirupa.com/t/localtoglobal-and-its-evil-cousin/139738>\
**Category:** Uncategorized\
**Created:** [March 5, 2005, 3:45am UTC](https://forum.kirupa.com/t/localtoglobal-and-its-evil-cousin/139738 "2005-03-05T03:45:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nih](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@nih](https://forum.kirupa.com/u/nih)\
**Post date:** [March 5, 2005, 3:45am UTC](https://forum.kirupa.com/t/localtoglobal-and-its-evil-cousin/139738/1 "2005-03-05T03:45:53Z")

</div>

I have the following objects:

```auto
_root.map.transformations.maptiles.spawner
_root.pawns.spawnedobject

```

The spawner object is having the heck transformed out of it, and the spawned object needs to follow it. I simply haven’t managed to get a handle on localToGlobal() or its friend globalToLocal(). Documentation and tutorials haven’t made things clearer, as neither of these work as I expect them to.

What I’ve found is that if I do localToGlobal inside the spawner in the form of:

```auto
this.localToGlobal()

```

…I can use the resulting coordinates to place the spawned object correctly. I expected to need to use:

```auto
_root.pawns.globalToLocal()

```

…on those results to get the final location, but using it actually misplaced the spawned object. So I didn’t use this function at all.

Now an object in a third path is breaking. The path is:

```auto
 _root.map.transformations.tileanimation.newspawnedobject

```

I can see where I’m going wrong, but I can’t see what I should be doing to get this working correctly. Any advice/examples?
