Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started 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?
-
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
-
Does the object have a rigidbody?
-
@ 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.
-
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.
-
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
-
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!!!?
-
Try lowering your gravity scale.
-
Hi,
maybe you have added some drag to your rb? it does affect the force required to move things.
Bye,
Jean
-
just change force to impulse... done
and you can lower your number now.. like to 5
-
Everything works just fine now =D!
Thank you everyone for the responses!
-
Or you can use Set Velocity. I always use that for jumping.
-
@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
-
@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?
-
I've been through all this, too. The only time I get a jump out of anything is if I use impulse...
-
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. :)
-
@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.
-
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.
-
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 !