What is the difference between an application of an impulse and an application of a force in relation to a physics engine?
1 Answer
An impulse is applied instantly, so it does not depend on the time step. You would use an impulse when you want to give a fixed boost of speed to something, or the physical action happens too quickly (ex. bullets/gun ricochet, collisions, jumps, instant speed ups).
Meanwhile a force changes the speed directly proportional to the time step. You use it for things that have an over time effect (ex. gravity, long springs, air resistance).
Mathematically impulse = force * time
; And for reference impulse = mass * velocity_change
, force = mass * acceleration
.
If you expand the first, you can check this:
impulse = force * time
->impulse = mass * acceleration * time
and sinceacceleration * time = velocity_change
->impulse = mass * velocity_change
.
-
1\$\begingroup\$ Since
impulse = force * time
, the impulse is also time dependent (at least if you use forces to get the impulse's magnitude). Indeed, momentum or impulse is useful for applying instantaneous dramatic changes. The most popular example comes from the laws of conservation of momentum and energy: physics.ohio-state.edu/~gan/teaching/spring99/C10.pdf. \$\endgroup\$– teodronAug 12, 2012 at 12:13 -
\$\begingroup\$ So is the implementation by
Jeff Lake
viaGame Coding Complete 3rd Ed. Chapter 15: Collision and Simple Physics
incorrect: (paraphrasing)Start with a Vector3d (or 2d depending) of forces F, Accumulate all Forces applied in a list, Accumulate All Impulses in a list add both totals to Forces, empty Impulses list, Accel = F / mass, Vel += Accel * deltaTime, Pos = Vel * time.
\$\endgroup\$– CaseyAug 12, 2012 at 17:56 -
\$\begingroup\$ @Casey: that is how I do it. In my simulator I can't use the rigid body case where two bodies collide and everything works out directly. Following the Newtonian way of integrating the acceleration to find the velocity and then the position. My impulses are derived from a repulsion force (response/reaction force is a synonym in my understanding):
i = F_response * DTime
. You can go either ways: use thei
impulse to correct the velocities after the collision, or use directly the response force. If you get the impulse from somewhere else, you canconvert it to anF_response
and it works OK. \$\endgroup\$– teodronAug 13, 2012 at 10:24 -
\$\begingroup\$ @teodron Thanks, that brings up a separate question which I'll ask ...separately. :P \$\endgroup\$– CaseyAug 13, 2012 at 15:20