playMaker

Author Topic: Set Position to GameObject?  (Read 2237 times)

SeanC

  • Junior Playmaker
  • **
  • Posts: 61
Set Position to GameObject?
« 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.



Thanks,
SeanC

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Set Position to GameObject?
« Reply #1 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.

SeanC

  • Junior Playmaker
  • **
  • Posts: 61
Re: Set Position to GameObject?
« Reply #2 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

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Set Position to GameObject?
« Reply #3 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.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D