Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: coffeeANDsoda on December 31, 2014, 03:07:41 PM

Title: Picking up objects
Post by: coffeeANDsoda on December 31, 2014, 03:07:41 PM
I'd like to know how can I set up a player to big up a object. I'd like to have the player to be able to pick up objects for puzzle purposes. Would it be required for each object to have a FSM in order to make this happen, plus, would that mean that the player would also have to have a separate FSM with a empty object parented to make the objects have a position while being carried?

https://db.tt/61MhSkk7

Title: Re: Picking up objects
Post by: richardh on December 31, 2014, 08:24:32 PM
I too would like to know how to go about doing this in Playmaker. A youtube tutorial would be really helpful since it would utilise methods not seen the other 'Playmaker beginner' tutorials.

Could some one proficient in Playmaker put one together?

Please?
Title: Re: Picking up objects
Post by: wheretheidivides on January 01, 2015, 06:04:53 PM
"A youtube tutorial would be really helpful since it would utilise methods not seen the other 'Playmaker beginner' tutorials.

On youtube they go over setting up the health manager and picking up objects.  It is a lot easier than I can explain.


basically, you set up a collision trigger.  then you when the player enters it a series of things are done like give extra health and destroy the object.  Watch the video.

Now, there may be a inventory manager for download on asset store.  I see them all of the time, but you want one that works with playmaker.  They are really cool as they will keep track of your stuff, actions, dialog and other things.
Title: Re: Picking up objects
Post by: wheretheidivides on January 01, 2015, 06:12:29 PM
Squarebite Inventory
If you want an out of the box solution, here is one with playmaker support.  I have never used it.

https://www.assetstore.unity3d.com/en/#!/content/13203
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 01, 2015, 07:45:18 PM
When I mean by pick up an object, I mean literally pick it up and move it around. Not a health or item that would disappear.
Title: Re: Picking up objects
Post by: richardh on January 01, 2015, 07:55:27 PM
@wheretheidivides you are describing a method of picking up items and storing them in an inventory. What I and the OP are looking for is a tutorial on picking a physical object up in game and being able to move that object about in the air and then place it in another location.

I have set up a FSM to do this but it has some problems that I can't seem to fix.

I think a fix for my FSM problem would be to find a way for the object I've picked up (and would be floating in mid air) to instantly drop to the floor is it touches any other object.

At the moment I can pick an object up and it becomes a child of the first person camera. I can then move the fist person controller around the game and the child object will float in front of the camera and move as the first person controller moves. I can drop the object too. BUT the problem is when it encounters either another rigid body (they both fly about) and/or it encounters any object that is not in the tag group I've set.

Also, if I drop the object close to a wall and then pick it up again, it will sometimes disappear through the wall.

I'm sure there is a way to achieve this but I can't find a solution.



Squarebite Inventory
If you want an out of the box solution, here is one with playmaker support.  I have never used it.

https://www.assetstore.unity3d.com/en/#!/content/13203
Title: Re: Picking up objects
Post by: richardh on January 01, 2015, 08:00:39 PM
When I mean by pick up an object, I mean literally pick it up and move it around. Not a health or item that would disappear.

@coffeeANDsoda
I've almost done this but I have some problems that need to be fixed (see my above post). I could do with some help fixing the problems.
Title: Re: Picking up objects
Post by: strange_aeons on January 01, 2015, 08:34:07 PM
i am a newbie at all this myself and i was playing around with a "Drag n Drop" kind of object pick up system a few days ago and i think i found that i encountered your problem also and it stopped happening when i set the object's "Is Kinematics" to on (its in the Rigid Body component of your object). you might want to have it so that kinematics turns back off when you let go of the object too if you want the object to interact with stuff.
Title: Re: Picking up objects
Post by: richardh on January 02, 2015, 04:50:19 PM
Yeah, I tried  "Is Kinematics" but the object is then able to be carried through walls and dropped through floors/terrains.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 03, 2015, 08:23:58 PM
Seems like people have the same issue as I have. Still stuck on it.
Title: Re: Picking up objects
Post by: wheretheidivides on January 03, 2015, 10:01:12 PM
"Seems like people have the same issue as I have. Still stuck on it. "
How about taking some pictures of the settings that you are using.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 03, 2015, 10:41:22 PM
How about taking some pictures of the settings that you are using.

https://db.tt/7DMM8ujc

That's what I have for it right now.
Title: Re: Picking up objects
Post by: richardh on January 04, 2015, 05:54:35 PM
Okay, after much work! This is what I've got so far. Pick up and drop the green objects in this scene. It's rough and ready but it works. Try long enough and you will probably succeed in getting a green object to penetrate a wall or something.

http://bit.ly/14nElbL (http://bit.ly/14nElbL)

And a bit of a YouTube clip:

Title: Re: Picking up objects
Post by: coffeeANDsoda on January 04, 2015, 07:39:20 PM
What does that mean for the needed actions to pull this off? And what other objects needed to get it to work? Or since you are using a first person prefab? See I want to pull this off without using scripts or the third or first person controller prefab.
Title: Re: Picking up objects
Post by: Lane on January 04, 2015, 10:05:14 PM
Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057
Title: Re: Picking up objects
Post by: richardh on January 05, 2015, 05:05:47 PM
@coffeeANDsoda There's just one set of FSM's on the object that you want to be a pickupable. But I have parented a trigger to the 1st person camera. It would be perfectly possible to set this up for a mouse-click event on the object though, rather than a controller.

What does that mean for the needed actions to pull this off? And what other objects needed to get it to work? Or since you are using a first person prefab? See I want to pull this off without using scripts or the third or first person controller prefab.
Title: Re: Picking up objects
Post by: richardh on January 05, 2015, 05:31:47 PM
Lane, How do you set this FSM up (dragWithGo)? I have it in my Playmaker Actions now, but I can't fathom how to use it. I've put it on a rigid body gameObject, and I've tried putting it on my 1st person controller and targeting a rigid body gameObject but alas I can't get it to work. can you list the steps to get it working with say a rigid body Cube?

thanks

Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057
Title: Re: Picking up objects
Post by: Lane on January 05, 2015, 06:01:28 PM
Think of it as a magnet. Put it on your character or weapon and use events from mouseclicks or something to jump in and out of the state where it is used.

Tweak the variables at runtime while the action is active to debug it as the settings have a huge impact on how the drag is handled and reacts overall.
Title: Re: Picking up objects
Post by: richardh on January 05, 2015, 07:05:18 PM
Thanks, Sussed it.

Think of it as a magnet. Put it on your character or weapon and use events from mouseclicks or something to jump in and out of the state where it is used.

Tweak the variables at runtime while the action is active to debug it as the settings have a huge impact on how the drag is handled and reacts overall.
Title: Re: Picking up objects
Post by: wheretheidivides on January 08, 2015, 06:37:31 PM
every time I come to this site, it always says this topic has unread posts, however it does not.  Something got messed up.  Weird.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 11, 2015, 11:54:30 PM
Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057

Wouldn't that mean I'd have to create a script instead of implementing playmaker actions onto the players fsm?
Title: Re: Picking up objects
Post by: wheretheidivides on January 12, 2015, 12:52:00 AM
If you want an easy out (not using playmaker) there are assets in the store that will do this easily.  I've seen them, but can't recall the names.  Just a thought.

Title: Re: Picking up objects
Post by: Lane on January 12, 2015, 07:22:27 AM
Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057

Wouldn't that mean I'd have to create a script instead of implementing playmaker actions onto the players fsm?

No.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 12, 2015, 05:25:27 PM
Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057

Wouldn't that mean I'd have to create a script instead of implementing playmaker actions onto the players fsm?

No.

And this URL does contain a example to pick up/carry a object with only actions?
Title: Re: Picking up objects
Post by: Lane on January 12, 2015, 05:55:02 PM
Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057

Wouldn't that mean I'd have to create a script instead of implementing playmaker actions onto the players fsm?

No.

And this URL does contain a example to pick up/carry a object with only actions?

Yes.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 12, 2015, 06:50:26 PM
Seen this?

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057

Wouldn't that mean I'd have to create a script instead of implementing playmaker actions onto the players fsm?

No.

And this URL does contain a example to pick up/carry a object with only actions?

Yes.

What I don't understand is that dragWithGo project has a c# script needed for this whole pick up and carry thing to work. I thought that's what you didn't want me to download, right?
Title: Re: Picking up objects
Post by: Lane on January 12, 2015, 07:34:54 PM
Actions are C# scripts.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 13, 2015, 03:23:34 AM
Actions are C# scripts.

I see. I tried the example scene, and for dragging a object doesn't work. So I created a scene with a object with a rigidbody. Problem is when I set up the player with a mouse pick event while having it transition into another state using Drag Digidbody With Go plus Mouse Pick Event on mouse off, it doesn't respond. And if I add a trigger event, it doesn't follow the player fast enough to keep up with the movement of the player. Plus it I'm not able to carry it like amnesia or half life 2.

So what else am I missing? Wouldn't be easier to set up a empty object to act like a magnet so I wouldn't have to deal with a global variable or global manager? Or would it be best to make a FSM for the object with a get or set position after the player interacts with it?


Title: Re: Picking up objects
Post by: Lane on January 13, 2015, 06:54:06 AM
Wouldn't be easier to set up a empty object to act like a magnet so I wouldn't have to deal with a global variable or global manager?

Yes, and that can be setup with the action. Give it a try.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 13, 2015, 09:59:56 PM
Wouldn't be easier to set up a empty object to act like a magnet so I wouldn't have to deal with a global variable or global manager?

Yes, and that can be setup with the action. Give it a try.

With a raycast or set position on the lifted object?
Title: Re: Picking up objects
Post by: Lane on January 13, 2015, 10:21:59 PM
Have you tried either?
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 13, 2015, 11:15:03 PM
Have you tried either?

On the object? Or the empty object that interacts with it? Last I checked, I got the same results. How would that work without Use Owner for both set position or raycast? Also, if I use Specify Game Object, it's only one with object, and the scene I have has more than one object. 
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 14, 2015, 11:02:19 PM
Plus, I also tried to attach a fsm to the object to lift up, but I still get the same results.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 15, 2015, 03:08:23 PM
Have you tried either?

By the way, this is what I have currently for the object that drags objects poorly.

https://db.tt/PgdahVss

https://db.tt/R7Exz2FI

Hope this helps to give you a idea of what I'm stuck on.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 16, 2015, 02:34:38 PM
While carrying the object around works by adding I think a move towards action in objects FSM, I still have a few problems.

I can't figure out a way to put it down even if I add 2 mouse pick events(since mouse off option does nothing).

Second, when I move the mouse it doesn't stay in one position, causing the object to turn around.

Third, even though it has collision, the object goes through walls and floors partially.
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 18, 2015, 03:35:05 PM
This is what I have for both FSMs.

https://db.tt/rK19NeoW

https://db.tt/zaK4wg83

https://db.tt/Bm1kMyLb

https://db.tt/DG3zp5zh

https://db.tt/O2ufMh8N

https://db.tt/5ut4w02Y

https://db.tt/5T4Y7lN6
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 25, 2015, 12:47:28 AM
@coffeeANDsoda There's just one set of FSM's on the object that you want to be a pickupable. But I have parented a trigger to the 1st person camera. It would be perfectly possible to set this up for a mouse-click event on the object though, rather than a controller.

For the state that deals with dropping, did you add actions like add force or set property in order to make it fall?
Title: Re: Picking up objects
Post by: coffeeANDsoda on January 26, 2015, 03:28:33 PM
I tried having a action turn kinematics off, and it still doesn't work. How come turning it off when creating a C# script for it works like the code below?

Code: [Select]
    void checkObject() {
         if(Input.GetKeyDown {KeyCode.E}) {
             dropObject();
         }
    }

    void dropObject() {
         carrying = false;
         carriedObject.gameObject.rigidbody.isKinematic = false;
         carriedObject = null;
    }
}
Title: Re: Picking up objects
Post by: ballista on November 24, 2015, 11:16:06 AM
I see this is an old topic but I was wondering how you got on with this as I'm in the same problem my self, but haven't been able to find a decent tutorial?   would be great if you could let us know how you got on with this. Cheers
Title: Re: Picking up objects
Post by: coffeeANDsoda on November 25, 2015, 04:49:26 PM
I see this is an old topic but I was wondering how you got on with this as I'm in the same problem my self, but haven't been able to find a decent tutorial?   would be great if you could let us know how you got on with this. Cheers

Closest thing I got to making something like that was from this youtube video.



Unfortunately, I think I got rid of a prototype recreating the needed FSMs for this issue.  Aside from this video, I am still stuck on it.  Want to implement picking up and dropping objects but can't figure out how to do it in playmaker.