Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: LatinoCreamKing on May 22, 2015, 07:49:04 PM

Title: how to "pick up" an object on button press?
Post by: LatinoCreamKing on May 22, 2015, 07:49:04 PM
so, i'm working on this project and i've been trying to set up a system that when holding down a key, you would "pick up" the object in front of you. kinda like half-life 2. i don't know how noobie or non-noobie this question is, but any help would be greatly appreciated! <3 thanks lovelies.
Title: Re: how to "pick up" an object on button press?
Post by: Tedthebug on May 22, 2015, 09:26:01 PM
So you want it to pick up while holding the key & then drop it when it is released?  Can you just use input.getkeydown to then get it to follow the cursor or whatever you want?  I think then once you let go of the key it should stop following & fall etc depending on physics &/or other scripting.

Not sure how you are identifying the object, whether it is when the player is colliding with it or if it is first person & there is a reticule or something on screen but you could apply the check to see what they are colliding with or what the reticule is over?

Still a noob myself so hope these help get to the answer.
Title: Re: how to "pick up" an object on button press?
Post by: LatinoCreamKing on May 23, 2015, 01:23:19 AM
how would I go about doing that? If I create a moveTowards on the crate, whenever I press the key, the crate will move to one spot and stop. it won't follow the point I have attached to the player.
Title: Re: how to "pick up" an object on button press?
Post by: Tedthebug on May 23, 2015, 01:59:51 AM
Remembering I'm a noob as well, & hoping someone with more skill jumps in to fix errors.

Is the item to move visibly 'attached' to the player or will the player stay still on screen while the item is moved around on the mouse cursor or something?

You could maybe check:
http://answers.unity3d.com/questions/12322/drag-gameobject-with-mouse.html

Sorry I can't help more
Title: Re: how to "pick up" an object on button press?
Post by: dudebxl on May 23, 2015, 08:56:08 AM
did you try 'Drag Rigid Body' action.

look at the ecosystem for more actions..