Add this field's force contribution to every eligible body in space.
Adds to (does not replace) each body's existing accumulated force, so
multiple fields and userland force writes all stack naturally. Call
once per frame, before space.step().
Compute (but do not apply) the force this field would exert on body
given its current position. Returns (0, 0) when the field is disabled,
the body is static, the body is filtered out, or the body is outside
maxRadius.
The returned Vec2 is fresh and owned by the caller.
Current world-space center of the field.
Returns the anchor's (x, y) — for a Body source this reflects the
body's current position each call, so the field automatically tracks
a moving anchor.
A point-source gravity field — pulls bodies toward an anchor with a chosen falloff law.
Replaces the manual
for (body of space.bodies) body.force = ...loops commonly written for orbital / planet / multi-body gravity scenarios. Multiple fields compose naturally via RadialGravityFieldGroup or by callingapply()on each one in sequence — each call adds to the existing accumulated force, so userlandbody.forcewrites are preserved.Example