Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started 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)
-
Whats making it stay in place/attached?
-
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.
-
You can add a Rigidbody to it and turn Gravity on.
-
How would that work for having objects appear? Like a crane just dropping objects?
-
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.
-
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.
-
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
-
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.
-
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.
-
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.
-
Can you take some screenshots of the FSMs you're having trouble with?
-
This is what I have for the crane.
https://db.tt/d2CwW48m (https://db.tt/d2CwW48m)
https://db.tt/FSKPLWR5 (https://db.tt/FSKPLWR5)
-
Give this a try.
-
I took a look at the example and applied those actions. Doesn't work.
https://db.tt/AKduhYd3
https://db.tt/hFeGngQX
-
Does the example do what you're trying to make your scene do?
-
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.
-
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.
-
What do you mean?
-
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.
-
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.
-
You should study the working example and try to bridge the gap.
-
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?
-
You should be spawning from a prefab and storing that variable. Replacing it every time you spawn a new one.
-
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.