Forces, not accelerations, are what the world really applies - and the same force moves a light body more than a heavy one. Today you give a body mass and turn an applied force into an acceleration with F = ma.
Give a body mass, let a force be applied to it, and derive the acceleration as force divided by mass.
Newton’s second law says force equals mass times acceleration, F = ma, so the
acceleration a force produces is F / m. That is why a feather and a bowling ball
fall at the same rate under gravity but respond very differently to a shove: gravity
scales its force with mass so the accelerations match, but an equal push on a heavier
body produces less acceleration. Give the body a Mass and a Force field,
apply forces to it, and convert the accumulated force to the acceleration your
integrator already consumes.
ApplyForce adds into the force field rather than overwriting it, because in a
moment you will want several forces (gravity, a push, a spring) to combine on one
body in a single step. Today only one force is applied, so the sum is just that
force - but writing it as an accumulation now sets up the next lesson, where summing
and clearing forces each step is the whole point.
// add Mass float64 and Force Vec2 fields to Bodyfunc (b *Body) ApplyForce(f Vec2) { b.Force = Add(b.Force, f) }// Newton's second law rearranged: a = F / mfunc (b *Body) accelerationFromForce() Vec2 { return Scale(b.Force, 1/b.Mass) }