playMaker

Author Topic: [SOLVED] How to deactivate "add force" (object just hangs in the air)  (Read 3481 times)

Susher

  • Playmaker Newbie
  • *
  • Posts: 3
Hi folks, I´m trying to make a 2D game object jump by tapping the screen.
So far I have created an "touch event" witch triggers "add force", Y coordinate.

The game object jumps all right, but it hangs in the air! lol, how can I stop the "add force"?
« Last Edit: April 03, 2013, 04:48:04 AM by Susher »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to deactivate "add force" (object just hangs in the air)
« Reply #1 on: April 03, 2013, 01:50:34 AM »
Hi,

 You likely need to exit the state where you apply the force, either by using a transition, or have another state implement a global transition.

 Are you sure this is a free falling gameObject? it could be  that it doesn't take in account the gravity, double check the physics component attached to this gameObject.

bye,

 Jean

Susher

  • Playmaker Newbie
  • *
  • Posts: 3
Re: How to deactivate "add force" (object just hangs in the air)
« Reply #2 on: April 03, 2013, 03:56:02 AM »
Hi Jean, this is how my setup looks like (attached screenshots).

The game object is jumping up from the ground (rage spline) when adding force,
and gravity is enabled yes.

Do I need to add another state after the apply force state?
If so, what state :) ? Do I need to copy the previous state and set it up with negative Y force? (to cancel out the force)? and then transition to the idle state again?




« Last Edit: April 03, 2013, 04:00:25 AM by Susher »

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: How to deactivate "add force" (object just hangs in the air)
« Reply #3 on: April 03, 2013, 04:17:35 AM »
First of all I must warn you: weight units in Unity are not kilos, they are TONS.

This said, first of all you should probably give an IMPULSE of force with adequate power (much more) and NOT every frame, so it will only be given to the object in one frame.

If instead you want to make it with the EVERY FRAME option, then add an action WAIT after that action, with the time you want the power added, add another state like END or something, and in the WAIT action set FINISHED and go to the END state.

Susher

  • Playmaker Newbie
  • *
  • Posts: 3
Re: How to deactivate "add force" (object just hangs in the air)[SOLVED]
« Reply #4 on: April 03, 2013, 04:47:28 AM »
O- shit.. :P, now I understand what the problem has been!
80 ton dog, lol.. a bit over fed!.

Also, the impulse setting worked, one frame!

Thank you so much megmaltese! Made my week!

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: [SOLVED] How to deactivate "add force" (object just hangs in the air)
« Reply #5 on: April 03, 2013, 12:51:16 PM »
Glad I can help, for once, instead than just bothering asking for help all the time  :D