Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: SeanC on December 29, 2014, 07:43:57 PM

Title: Set Position to GameObject?
Post by: SeanC on December 29, 2014, 07:43:57 PM
Hi all,

I feel like I am missing something simple, but I searched through the forums and couldnt find the answer, so I'll post it up here and see what the experts say.

I was looking for a way to simply set the position of "GameObject A" to "GameObject B", but my only option in the SetPosition action is to use vectors or floats. Is there no way to simply snap one object to another? It seems like a waste of time to have to get a vector 3, store it, and then feed it into an action.

(http://i.imgur.com/L0XB4sX.jpg)

Thanks,
SeanC
Title: Re: Set Position to GameObject?
Post by: wheretheidivides on December 29, 2014, 11:15:21 PM
You could try parenting.  Make object 2 a child of object 1 so whenever object 1 moves, object 2 goes with it.  then you can separate them.
Title: Re: Set Position to GameObject?
Post by: SeanC on December 29, 2014, 11:22:13 PM
That is a good solution, however, it can still leave you in the same spot. For example, "A" needs to snap to "B", so I parent it to "B" and reset the position. Great! Except now I need "A" to unparent and go back to its original owner, so first I need to have stored that in a seperate variable and then use another set parent action to get it back under the correct hierarchy.

This method does work, and helps clear up some messiness, but it still isn't as straightforward as simply being able to have a gameobject be the target of a "SetPosition" action.

Is it possible someone has a custom action floating around for that? If not, then this is a great workaround that I will definitely use!

Thanks,
SeanC
Title: Re: Set Position to GameObject?
Post by: Lane on December 30, 2014, 06:30:10 AM
I usually just use Get Position and Set Position when i want to put something right on top of another game object. I agree it would be nice to have a Game Object as a target, I doubt that was considered a common use case when the action was made though.