playMaker

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

ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
    • View Profile
[SOLVED] Turn gravity on and off?
« on: April 29, 2016, 05: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, 01:01:17 AM by ShazBang »

KellyRay

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

ShazBang

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

ransomink

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
Re: Turn gravity on and off?
« Reply #3 on: April 30, 2016, 10:11:56 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...

ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
    • View Profile
Re: Turn gravity on and off?
« Reply #4 on: May 02, 2016, 05: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: 25
    • View Profile
Re: Turn gravity on and off?
« Reply #5 on: May 02, 2016, 09:56:12 PM »
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...