Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Redxlotus on May 15, 2017, 06:49:13 PM

Title: Add Force 2D (Jumping) not responding.[SOLVED]
Post by: Redxlotus on May 15, 2017, 06:49:13 PM
Hello everyone!

I recently got Playmaker to help me out on my project, so i'm rather new to the whole program.

Anyway, I setup the character movement (2D plane) he can walk left and right, animations work and he flips like a pro. If only the same could be said for his jumping skills.

(things I used in the walking FSM: Get axis, get key down x2 and set velocity 2D)

For jumping I added a get button down on one state and on a new state the add force 2d. I added a force of 500 on the y axis  and further nothing. When I press space, I can see the loop working in the editor, but my character just stands there and does not move one inch.

Any ideas what could be the problem?

Title: Re: Add Force 2D (Jumping) not respoding.
Post by: HeathClose on May 16, 2017, 08:04:51 AM
can you take a pic of your 2 states that loop with key down so we can see what the actions are set up as
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Fat Pug Studio on May 16, 2017, 08:31:25 AM
Does the object have a rigidbody?
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Redxlotus on May 16, 2017, 11:13:57 AM
@ Krmko: Yes, my object does have a Rigidbody, but the 2D one. I added apicture with the settings!

@HeathClose: Here you go!

First it thought might be something to do with Anima 2D, but when i set up a new project and just made a simple image with the same playmaker code it just did not want to jump either.
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Fat Pug Studio on May 16, 2017, 11:35:05 AM
Did you try using debugging to see what the console has to say? Also, try using get owner action and saving the object under a game object variable, then reference the variable in the add force action.
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Ofonna on May 16, 2017, 12:53:50 PM
disable all other FSMs including the animator component and try again. there might be something you're doing every frame that's keeping your player game object in one position
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Redxlotus on May 16, 2017, 05:16:50 PM
Ok like what the actuall what... xD

After messing around a lot... and adding the get owner to the fsm it was still not working.

Then I tried adding more force to Y(mind you, a lot of videos showed values as low as 250 for jumping), I thought I already had it quite high so I dismissed that as the problem. It seems I was wrong. Adding a force of 20000 seems to make the character hop a bit. Only after bumping it up to 70000 I have it jumping the amount I want..

How can this number be so high!!!?
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Fat Pug Studio on May 16, 2017, 05:22:32 PM
Try lowering your gravity scale.
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: jeanfabre on May 17, 2017, 02:41:05 AM
Hi,

 maybe you have added some drag to your rb? it does affect the force required to move things.

 Bye,

 Jean
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: HeathClose on May 17, 2017, 02:56:33 PM
just change force to impulse... done

and you can lower your number now.. like to 5
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Redxlotus on May 23, 2017, 04:55:44 PM
Everything works just fine now =D!

Thank you everyone for the responses!
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Rabagast on May 23, 2017, 05:19:31 PM
Or you can use Set Velocity. I always use that for jumping.
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Redxlotus on May 25, 2017, 07:32:03 PM
@Rabagast

Nice suggestion, thanks! It seems to take more normal values than the add force 2D. Tried lowering the values, but it still needed values over the 10000 to achieve liftoff :P
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Rabagast on May 26, 2017, 08:25:47 PM
@Rabagast

Nice suggestion, thanks! It seems to take more normal values than the add force 2D. Tried lowering the values, but it still needed values over the 10000 to achieve liftoff :P


10000? Even if you use Set Velocity? I use maybe 20 or something. It's very strange that you need that high value.

If you go to Project Settings/Physics, what value do you have to the gravity?
Title: Re: Add Force 2D (Jumping) not responding.[SOLVED]
Post by: HeathClose on May 27, 2017, 07:27:48 PM
I've been through all this, too.  The only time I get a jump out of anything is if I use impulse...
Title: Re: Add Force 2D (Jumping) not responding.[SOLVED]
Post by: Rabagast on May 28, 2017, 03:59:13 PM
I did a test. With Add Force - Force, I used 500. It was enough in my case. Then I set it to Impulse. To get the same jump height, I had to use 10. The same with Set Velocity, But 10000? It will jump to Mars, or maybe out of the Galaxy. :)
Title: Re: Add Force 2D (Jumping) not respoding.
Post by: Rabagast on May 28, 2017, 04:56:04 PM
@Rabagast

Nice suggestion, thanks! It seems to take more normal values than the add force 2D. Tried lowering the values, but it still needed values over the 10000 to achieve liftoff :P


What number do you have in the Mass field in the Rigidbody? Because Mass affect the Add Force - Force, but not impulse. I tried to set the Mass to 100, then I had to use 50000 to the Add Force to get the same jump height.
Title: Re: Add Force 2D (Jumping) not responding.[SOLVED]
Post by: Redxlotus on June 01, 2017, 01:00:45 PM
These are the settings that are used :o pressed reset just in case, but it stayed the same. See anything off?

and with set velocity it works normally I use 10 to make my character jump so that's all fine and dandy.

EDDIT:

Before I upgraded unity to 5.6.1 add force2D with impulse yielded the same result (10k+ to get my character to jump a bit)

Now in version 5.6.1 addForce2D works fine, with a value of 10. So I have no idea what changed. Might be a bug :o I really don't know.
Title: Re: Add Force 2D (Jumping) not responding.[SOLVED]
Post by: MaxD on June 14, 2023, 09:00:58 PM
Hi everyone,
So long after this thread was created, I've been though the same problem and found the explanation.
Same as above, I set a jump FSM with the Set Velocity 2D action and, what prevented the player to jump in my scene was that, by default, the Vector x,y (of the Set Velocity 2D) was set to 0,0 and remained that way even when I entered a Velocity value. So be sure to 'deactivate' the vector (switch it to none) if you encounter the same problem and everything else is as it should be, this should solve the issue !