PlayMaker Help & Tips > PlayMaker Help

Can't get consistent jump height at different framerates

<< < (3/3)

jeanfabre:
Hi,

 I think you are overcomplicating this a lot.

 Your curve should represent the whole jump, including wait time at the apex, etc etc.

also, why not use just physics, controlling velocity with a curve seems counter intuitive to me, give it a push up, and let the physics handle the acceleration deceleration using the physics engine itself. it seems you are trying to force the hand of the physics engine instead of setting up the rigidbody properly and simply use "add force" when you want to jump. This will be far more predictable, fps independent and way easier to tweak.


Also, you need to realize that while PlayMaker editor is open, the performances are all over, because playmaker takes a lot of perfs out, so your game isn't running as it will when published. Try to play without playmaker editor and then open it and see the values.

Bye,

 Jean

Thore:
Hi,

I work on a 2D platformer as well, and even though my design has nothing to do with hardcore precision platforming, here’s what I learned:

1) Generally apply the jump force with Add Force (2D), because it’s then applied at once and physics takes it from there. This should resolve most inconsistencies.

2) play around with mass, gravity scale and drag in that order. The default behaviour is quite floaty. To get a tighter jump, you need to add more force, but at larger gravity scale working against it. As you will see, these values are totally dependent of one another and need a lot of tuning and testing. This should contribute towards a feel of more precision.

3) to get a really polished jump, you need to add a lot more stuff, not mentioned in typical tutorials. Among them “hang time” which might also contribute towards consistency, i.e. set vertical velocity to 0 for a few frames at peak height.

MarkD:
Many thanks Thore and Jean!  I'm going to give your suggestions a try and will let you know how it goes.

Thore:
Another thing that was a major pitfall for me: you have to be super aware with set velocity, and velocity “stored” in an object. Set velocity will override movement that might otherwise be influenced by something else. For example, without input, it can set the velocity to zero if the character is attached to joint, on a platform etc. resulting in odd behaviour. The other situation, that velocity is stored but is not visible, can occur when you change e.g. the rigidbody body type temporarily, or when jumps don’t have a cool down and the forces can stack in a frame for some reason. Things became a ton easier once I monitored the velocity on screen (just via a UI text element). You might also want to cap it to a certain range to prevent freak behaviour. I made an action for this, somewhere in the forum.

Navigation

[0] Message Index

[*] Previous page

Go to full version