Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ShazBang on April 29, 2016, 08:59:47 AM

Title: [SOLVED] Turn gravity on and off?
Post by: ShazBang on April 29, 2016, 08:59:47 AM
Hey, I have a floating object and when I press a button I would like it to drop to the ground using physics so that it will bounce off of other objects.

Is there an action that would allow me to, when I get mouse down on the object, make it fall?

Thanks.  ;)
Title: Re: Turn gravity on and off?
Post by: KellyRay on April 29, 2016, 09:22:04 AM
Depends on how you are floating your object. Are you using physics?
Title: Re: Turn gravity on and off?
Post by: ShazBang on April 29, 2016, 10:42:36 AM
I'm just using an iTween action that moves it along the X axis
Title: Re: Turn gravity on and off?
Post by: ransomink on April 30, 2016, 01:11:56 PM
Make sure your floating gameobject has a Rigidbody component attached to it and set 'Is Kinematic' to true (make sure checkbox is checked). When your button is pressed, use the action "Set Is Kinematic" inside Physics drop-down to enable gravity on the gameobject. It will fall using physics...

NOTE: The floating gameobject must have a collider to interact with other objects or it'll pass through everything and continue falling until oblivion...
Title: Re: Turn gravity on and off?
Post by: ShazBang on May 02, 2016, 08:35:52 AM
Make sure your floating gameobject has a Rigidbody component attached to it and set 'Is Kinematic' to true (make sure checkbox is checked). When your button is pressed, use the action "Set Is Kinematic" inside Physics drop-down to enable gravity on the gameobject. It will fall using physics...

NOTE: The floating gameobject must have a collider to interact with other objects or it'll pass through everything and continue falling until oblivion...

Thanks so much man!  :D
Title: Re: Turn gravity on and off?
Post by: ransomink on May 03, 2016, 12:56:12 AM
No problem, I enjoyed figuring it out; Learned something myself. Just edit the subject and append the [SOLVED] text at the end so others can check the solution...