Difference Between Force and Impulse in Planck.js?

In planck.js (a 2D JavaScript physics engine based on Box2D), manipulating rigid bodies often comes down to choosing between forces and impulses. While both methods alter an object’s motion, they do so over entirely different timescales: applying a force modifies velocity gradually over time, whereas applying an impulse changes velocity instantaneously. Understanding this distinction is crucial for creating realistic physics interactions, such as smooth vehicle acceleration versus sudden, explosive collisions.

Applying Force (body.applyForce)

When you apply a force to a body, it represents a continuous effort sustained over a period of time.

Applying Impulse (body.applyLinearImpulse)

An impulse represents an instantaneous change in momentum, effectively bypassing the gradual buildup of force.

Key Differences at a Glance

Feature Force (applyForce) Impulse (applyLinearImpulse)
Velocity Change Gradual (over multiple frames) Instantaneous (in a single frame)
Duration Sustained (requires continuous calls) Immediate (usually a one-time call)
Math Impact Changes acceleration, which changes velocity Changes velocity directly
Real-world Analogy Pushing a heavy shopping cart Striking a billiard ball with a cue