playMaker

Author Topic: how to "pick up" an object on button press?  (Read 2744 times)

LatinoCreamKing

  • Playmaker Newbie
  • *
  • Posts: 2
how to "pick up" an object on button press?
« 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.
« Last Edit: May 22, 2015, 07:50:39 PM by LatinoCreamKing »

Tedthebug

  • Playmaker Newbie
  • *
  • Posts: 21
Re: how to "pick up" an object on button press?
« Reply #1 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.
« Last Edit: May 22, 2015, 09:40:46 PM by Tedthebug »

LatinoCreamKing

  • Playmaker Newbie
  • *
  • Posts: 2
Re: how to "pick up" an object on button press?
« Reply #2 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.

Tedthebug

  • Playmaker Newbie
  • *
  • Posts: 21
Re: how to "pick up" an object on button press?
« Reply #3 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

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: how to "pick up" an object on button press?
« Reply #4 on: May 23, 2015, 08:56:08 AM »
did you try 'Drag Rigid Body' action.

look at the ecosystem for more actions..