playMaker

Author Topic: [SOLVED] Turn gravity on and off?  (Read 3646 times)

ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
[SOLVED] Turn gravity on and off?
« 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.  ;)
« Last Edit: May 04, 2016, 04:01:17 AM by ShazBang »

KellyRay

  • Full Member
  • ***
  • Posts: 170
Re: Turn gravity on and off?
« Reply #1 on: April 29, 2016, 09:22:04 AM »
Depends on how you are floating your object. Are you using physics?

ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
Re: Turn gravity on and off?
« Reply #2 on: April 29, 2016, 10:42:36 AM »
I'm just using an iTween action that moves it along the X axis

ransomink

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Turn gravity on and off?
« Reply #3 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...

ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
Re: Turn gravity on and off?
« Reply #4 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

ransomink

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Turn gravity on and off?
« Reply #5 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...