Yes, I could get the world position of the object, parent it, and then set the world position back but wouldn't that cause it to flicker for a moment, as the parenting moves it away, and then the set world position moves it back?
Or do I read it here correctly that every action in a state is run in the same frame?
So there won't be no flickering?
https://hutonggames.fogbugz.com/default.asp?W174What I am trying to do is random generating the level for a platformer:
- place a platform,
- spawn some elements: enemies, helpers, coins, etc. onto some child points (I use SetParent with ResetLocalPosition TRUE) of the platform,
- then when the platform is out of the camera view, parent it back to the platform pool object to be reused later,
- BUT some elements of the platform which were spawned to be parents of the platform's spawn point, have to stay around for longer, so this is when I tried to parent the element, to a temporary parent (to remove it from the platform before moving that away) and was hoping it would stay in the same position, but instead it jumps to another location.
(Thore is probably right with the local space guess.)
I'll try and return with the result.....
edit: it works nicely, the object does not flicker at all:
- GetPosition in World space,
- Parent away from the platform to something else,
- SetPosition back to same World space position.
all in the same state.
- Move the platform away, (this is actually in another FSM)
Thanks,
szomaza