# How is this jump possible in unity?

My jump force is 3000N which is applied as an Impulse.
My player mass is 100kg
Gravity is -61.3.

if ( inputJump){

inputJump = false;
}

This makes my player do a good jump but when I calculate on it, it shouldn’t be possible.
But Im thinking that maybe I don’t know how long the impulse was applied but I assumed it simulated for 1s.

For 1s the impulse would be (3000 - 100*61.3 ) x 1s =approx - 3000N which wouldn’t allow the player to jump.

Can someone help me out to explain this? If 1s is not correct please advice how I can get the real time.

We should think about velocity for this:

So, firstly:

Imagine a particle with a constant acceleration of g (which, in this case is 61.3 m/s/s).

Therefore, we have

So, in Δt, t changes from t1 to t2
At the same time, v changes from v1 to v2

Since [quote]
v = u - gΔt
[/quote] the acceleration downwards is a mere 61.3m/s/s
3000N of force, on the other hand, gives 300m/s/s acceleration to an object of 100kg, greatly outdoing gravity.

Hope this helps
(if it does, please like - I’m on a like quest )

Yes it helps or simple F > m*g . But I still don’t know for how long the force is applied => cant calculate Impulse

If you how to find this delta time I will give you a like

You both realize the likes mean nothing here I hope.

1 Like

Its nice to have some anyways (its like saying thanks, a like can make you feel smug - especially when you’re a insecure 14 year-old XD )

This is the physics timestep: http://docs.unity3d.com/Manual/class-TimeManager.html. In game time this is essentially instant (but you can treat it as one second in calculations).

To get the delta time of each frame, its Time.deltaTime.

The force is applied instantaneously (and the docs mention this on the force modes).

Matthew: yes but this still means is applied for period of time and I was asking for that time.

0s.

The velocity is X before the force is added and then instantaneously Y afterwards. It’s a physics engine, not reality–you can change the velocity of something without changing its position.

If you wanted to apply a force over 1s, you would have to apply that force once every FixedUpdate for a second…

If the force was applied for 0s there wouldn’t be an impulse.

You seem hung up on using real-world physics terminology or something? Time is not a factor in impulses here; you are modifying the object’s velocity. The object itself won’t move as a direct result of your impulse until the next physics simulation step.

If you apply a force once, like a jump, its behavior is going to be determined by the rest of your simulation (gravity settings, drag, other forces in play, etc).

Box2D is open source. Here’s the comments around applying an impulse: Google Code Archive - Long-term storage for Google Code Project Hosting.

``````/// Apply an impulse at a point. This immediately modifies the velocity.
/// It also modifies the angular velocity if the point of application
/// is not at the center of mass. This wakes up the body.
/// @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
/// @param point the world position of the point of application.
/// @param wake also wake up the body
void ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake);
``````

And the actual application:

``````m_linearVelocity += m_invMass * impulse;
m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse);
``````

Of course thats one of the reasons I wanted to use unity, a working physics engine .
Didn’t understand if Box2D was a pointer for me to follow regarding impulse or you way of expressing what an impulse is?

Doesn’t matter if you use impulse or force, gravity/drag etc will still influence the body. Can’t see why unity would separate it like that, using a well known physics term Impulse and letting it be something else.

I guess I’m just confused why you’re confused? Impulse is used that way across all physics engines, as far as I know. The Box2D link is showing you exactly what’s happening under the hood, which should be enough info to calculate jump heights or whatever you’re trying to do.

The thing with physics engines is that time is just an abstraction. Time is essentially frozen when your code is actually running inside of a FixedUpdate callback. It isn’t until the next simulation step when velocities and things result in actual movement.

Your original assumption–that the force was applied over an entire second–was something I wanted to help clear up. Forces are modifying velocities directly, and those will play out depending on the rest of your simulation…

Maybe Im not clear enough. The Box2d is about how I calculate on things on paper. They use Impulse as well and however you want to explain it still contains a time period which is unknown and asked for in this thread.

Though you can see Impulse of X as A Newton Force x B times in second. So if I apply 3000 Ns Impulse I was guessing that I could see it as a force of 3000 N applied for 1 second. Why do I need to know this? Because my feeling is that the physics engine isn’t reliable and I will also make my game as real as possible (physics based on calculations) . You can see in my other thread for example that gravity isn’t really reliable.

@popeye1 : 100% physical accuracy is not a goal of Unity’s physics engine or any real time physics engine for that matter. You won’t get far expecting accuracy or consistency from such systems. What you will get is real-time performance and good enough realism.

It’s also a good idea to get into the mindset of knowing when to let go and just accept that a certain API call might not mean what you think they do or might not behave like you think they should. Find a workaround that gives you the results you want and then move on. In this case, if you really need to apply an impulse, then you can apply a force over multiple frames and see how that works for you.

@shaderop : sure Im right now just a beginner of Unity that tries out things. But you’re right and Ive had the feeling for several days now that I should let it go but I can’t since I know some people now how to work with this engine so you get close to real physics.(working with calculations re forces etc) For example in my thread about gravity, is it supposed to differ up to 2-3x10^-2 (or alternating between two numbers with this difference) when gravity is default? I think its possible to handle this problem but I don’t know yet.

Im okey with to have false values but Im not ok with inconsistent values.