PDA

View Full Version : local to local



SticksStones
February 20th, 2009, 10:12 AM
Hi,

I have several nested layers, affected by scale and rotation. Most of the action happens on my main game layer, 2 layers deep from the root. In that layer i have a spaceship, in that layer, a rotating turret, within that the gun image, it's registration point is used as the bullets spawn location.

I need to convert to bullet spawn point's on screen location to it's relative position on the game layer, in a similar fashion to using local to global, but really I need a local to local function, which I'm 99% sure doesn't exist. Any ideas?

Thanks
Andy

rrh
February 20th, 2009, 12:25 PM
globalToLocal(localToGlobal())

SticksStones
February 20th, 2009, 01:14 PM
The order of nested clips goes like this...

root/scale/game/craft/turret/gun

I need to find the relative co-ordinates of the gun, in the game layer.

I really want to put the main body of the code in the turret layer, so each turret is autonomous.

So if i call localToGlobal(gun) from the turret layer, then pass the result to a function in the game layer, which calls globalToLocal(result) and returns the new result to the turret ...would that work?! or am i getting it all wrong.