Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: coffeeANDsoda on March 10, 2014, 01:24:24 AM

Title: Dropping items in playmaker.
Post by: coffeeANDsoda on March 10, 2014, 01:24:24 AM
How do I set up a game object to generate items to drop down with only playmaker?

Thanks.

(https://db.tt/XYrLRWxo)

Title: Re: Dropping items in playmaker.
Post by: Lane on March 10, 2014, 07:50:43 AM
Whats making it stay in place/attached?
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 10, 2014, 03:44:36 PM
Whats making it stay in place/attached?

I forgot to remove the block and it's fsm. I want the object above it to drop objects that it generates. 
Title: Re: Dropping items in playmaker.
Post by: Lane on March 10, 2014, 03:46:31 PM
You can add a Rigidbody to it and turn Gravity on.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 10, 2014, 03:53:25 PM
How would that work for having objects appear? Like a crane just dropping objects?
Title: Re: Dropping items in playmaker.
Post by: Lane on March 10, 2014, 04:02:35 PM
Setting up a physics based crane is no simple task, but one easy way to sort of do it is... you can disable the rigidbody, parent the box to the crane and when you want to drop it just unparent it and turn on the rigidbody, gravity will take over.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 10, 2014, 04:20:50 PM
And that way, it drops a single object in the whole game, or does it drop another after the player catches it? Because I thought about making a stacking game where player has to catch objects.   
Title: Re: Dropping items in playmaker.
Post by: Lane on March 10, 2014, 05:45:33 PM
It does whatever you tell it, if you tell a Rigidbody to use gravity then it will fall down.

If you're using physics and stacking, it'll be worthwhile to look into the physics joints.

https://docs.unity3d.com/Documentation/Components/comp-DynamicsGroup.html
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 11, 2014, 02:13:30 AM
Setting up a physics based crane is no simple task, but one easy way to sort of do it is... you can disable the rigidbody, parent the box to the crane and when you want to drop it just unparent it and turn on the rigidbody, gravity will take over.

What does that mean for actions? When I Add force and create object to drop, not only it drops down at a lower position than the spawn point, but another object doesn't drop down. I want to set up so another responds when the player catches it.

Title: Re: Dropping items in playmaker.
Post by: Lane on March 11, 2014, 07:20:35 AM
All you have to do to make it fall with physics is add a Rigidbody Component and turn on gravity in the component. You shouldn't need Add Force down unless there is some reason you need to disable gravity. Which is fine, gravity is equivalent to roughly (9.81 * mass) if you wanted to do it explicitly in an action.

The hard part with doing it with physics is setting up the physics joints properly. Faking this with parenting and disabling rigidbody parts is easier than using the joints I think.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 11, 2014, 04:27:08 PM
All you have to do to make it fall with physics is add a Rigidbody Component and turn on gravity in the component. You shouldn't need Add Force down unless there is some reason you need to disable gravity. Which is fine, gravity is equivalent to roughly (9.81 * mass) if you wanted to do it explicitly in an action.

Game object drops down realistically when I decreased the time of waiting in the first state. However theirs two problems. One being that they don't keep spawning in order to stack on top of the player. Second is, when the object falls on the player(which is a cube), it acts like it ricochets or bounces off of the player.

The hard part with doing it with physics is setting up the physics joints properly. Faking this with parenting and disabling rigidbody parts is easier than using the joints I think.

For now I have the crane set up so it doesn't have multiple objects representing parts of it like a real crane does. So it uses a itween action to go front to backwards.
Title: Re: Dropping items in playmaker.
Post by: Lane on March 11, 2014, 04:28:30 PM
Can you take some screenshots of the FSMs you're having trouble with?
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 11, 2014, 04:44:04 PM
This is what I have for the crane.

https://db.tt/d2CwW48m (https://db.tt/d2CwW48m)



https://db.tt/FSKPLWR5 (https://db.tt/FSKPLWR5)
Title: Re: Dropping items in playmaker.
Post by: Lane on March 11, 2014, 05:24:02 PM
Give this a try.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 20, 2014, 03:57:25 PM
I took a look at the example and applied those actions. Doesn't work.

https://db.tt/AKduhYd3

https://db.tt/hFeGngQX
Title: Re: Dropping items in playmaker.
Post by: Lane on March 20, 2014, 04:01:03 PM
Does the example do what you're trying to make your scene do?
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 20, 2014, 04:06:34 PM
Does the example do what you're trying to make your scene do?

For dropping things? Yes, but then theirs a button GUI, and I want generate items as oppose to generating items by clicking. Still though, items don't drop with the FSM setup I posted.
Title: Re: Dropping items in playmaker.
Post by: Lane on March 20, 2014, 04:23:14 PM
Does the example do what you're trying to make your scene do?

For dropping things? Yes, but then theirs a button GUI, and I want generate items as oppose to generating items by clicking. Still though, items don't drop with the FSM setup I posted.

Thats because your gravity on/off is backwards.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 20, 2014, 04:32:29 PM
What do you mean?
Title: Re: Dropping items in playmaker.
Post by: Lane on March 20, 2014, 04:45:07 PM
1) Spawn something
2) Store it in a variable
3) Turn on gravity for that Rigidbody (Make sure it has a Rigidbody)
4) It's going to start falling.
5) Turn off gravity on that object to make it stop falling, or to not fall at all.

If the crane example works fine, its just a matter of looking through it and finding out what is different between yours, then making it work for you.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 20, 2014, 05:23:16 PM

5) Turn off gravity on that object to make it stop falling, or to not fall at all.

If the crane example works fine, its just a matter of looking through it and finding out what is different between yours, then making it work for you.

When I did that the cube already in the scene drops but the second cube doesn't drop when I turn off gravity. When I turn on gravity on the "create" state, it drops, collides with the previous cube then falls through the floor.  On top of that, I can't get cubes respawn because the forth state just stops after the second cube drops.
Title: Re: Dropping items in playmaker.
Post by: Lane on March 20, 2014, 05:28:50 PM
You should study the working example and try to bridge the gap.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 20, 2014, 05:56:23 PM
You should study the working example and try to bridge the gap.

Still doesn't make sense, because I looked at how the example FSM respawns with setup it has and did a comparison to the version I made without  GUI buttons. By any chance, would the reason be that it's having a conflict with prefabs? Since the action Create Object has a prefab as oppose to a regular cube?
Title: Re: Dropping items in playmaker.
Post by: Lane on March 20, 2014, 07:57:32 PM
You should be spawning from a prefab and storing that variable. Replacing it every time you spawn a new one.
Title: Re: Dropping items in playmaker.
Post by: coffeeANDsoda on March 28, 2014, 04:27:49 PM
I see. What would I have to do to make the item dropping being synchronized with the crane? When it moves it doesn't drop at the position of the crane moving.