A better method for jumping

Hi,

Until now I’ve been trying to do jumping by simply adding a force with the appropriate sensor, and while this works it just feels slow and too “floaty”. Adding more force makes the object go higher, wich is not appropriate here.
I’ve played with many values for gravity and mass and forces, but I can’t get the goddamn thing to look believable.

Another method would be just moving the object, but then it just snaps into position, without actually moving.

And on top of that both methods are a pain in the ass to sync with animation.

Anyone has a better idea on how to do jumping?
(Just as a reference I’m trying a 3d fighter like Virtua Fighter or Tekken, of course on a much smaller scale)

Do you know that 1BU is = 1meter?

What high is your character?

What do you have set for the mass? Also, you may want to be using linear velocity rather than force in this case.

The mass does not influence the falling. It will be taken into consideration when interacting with another object (e.g. on collision).

There is translation damping. It simulates the air friction. This belongs to all physical translation - not just falling.

You can set linear velocity (once) to skip the calculation of how much force you need to get this beginning velocity. Finally it does not really matter as long as you do not constantly apply the force or the velocity (it would become a rocket).

The initial velocity will influence the highest point of the jump, but not how fast the object will fall (as already discovered).

The major factors starting with zero speed are:

  • gravity
  • travel distance

That is the reason why I asked the size of the character.
A 50 m giant will fall the same speed as a 50 cm dwarf when thrown from the same cliff.
In relation to the own high it looks like the giant is falling slower.

It just takes longer to reach 50m/s than 50cm/s.

I had to look the character height, a staggering 16 meters tall! :eek:
Just lost track when modelling, but everything else is about the same scale, so it looks normal when played, what really meters is the mass.
I have disabled the translation dampening, but it’s so tiny by default, that doesn’t make any noticeable difference.
Setting the velocity instead of a force looks a bit better, I’ll make tests with that.
And of course the mass won’t change the free fall speed, Galileo already knew that.:smiley:
Maybe adding a down force when the character is jumping, or even disabling gravity and doing everything by speeds instead of acceleration.

Go and multiply gravity by 16

With a little python, you can have a lot of control of how your objects move.

Here is a lil file I put together
Use W to make the cubes jump.

When we’re on the ground, and hit W, force is applied. I factored scene gravity and object mass into the equation for force, so you should be able to tweak those independently and the script should scale to compensate.

The cube uses two variables to calculate its jump: FORCE and VELOCITY

Higher force gives you more upward push.

VELOCITY should be a float between 0.0 and 1.0; 1.0 being equal to ‘normal’ bullet physics gravity.
The closer you set velocity to 0.0, the ‘faster’ your cube will go through the air, but the more FORCE you will need to get the same jump height.

When the script is not handling the force of the jump (ie we are in the air), it looks at its own.localLinearVelocity.z.
If our z velocity is 0 or lower, we are ‘falling’, when it’s above 0 we are ‘rising’.
While we’re rising, our velocity is getting divided by the factor of our Velocity; we are decelerating and reaching 0 velocity faster.
While we’re falling, our velocity is getting multiplied by the factor of our Velocity; we are accelerating toward the ground faster.

(Thanks to BPR for smiting me over the noggin with this knowledge!)