Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: TheBadFeeling on January 19, 2014, 06:29:38 PM
-
Hi, I'm a graphics designer (read: Unity n00b) trying to program my first mini game ::) -- a simple 2d drag'n'drop thing.
I'm trying to construct a snap-to behavior, so that when i drag an object (Obj1) across the screen and it enters the rect of Obj2, Obj1 will snap to Obj2's location.
So far I have set Obj2 up to shout out whenever Obj1 is dragged inside its collider and that works great. But I want Obj2 to send its transform (or x and y) to Obj1 -- so Obj1 knows where to "snap to".
I'm trying to use "Get transform" but it stores the result in an Object, not x and y values. How do I get x and y out of that object so that I can set Obj1's location? Or should I use another action instead?
Thanks,
/Bad
-
With obj1 selected and a FSM available in the playmaker editor click drag obj2's transform component into the state editor. This should prompt you to get or set variables and items from obj2 transform. You may want to lock obj1's graph editor before click draggin obj2.
-
Thanks for the suggestion! I'll give it a try. 8)
/Bad