Function magnitudeForce

A force based on the square of the thing's velocity. It's like velocityForce, but here the velocity has a bigger impact.

const thing = {
position: { x: 0.5, y:0.5 },
velocity: { x: 0.001, y:0 }
};
const drag = magnitudeForce(0.1);

// Apply drag force to thing, returning result
const t = Forces.apply(thing, drag);
  • Parameters

    Returns ForceFn

    Function that computes force