Skip to content

Friction & Drag

Friction reduces speed with the velocityForce . This force essentially scales the current speed by the force value. By passing multiply as the second parameter, we can enhance the force with mass - heavier object, more friction.

const friction = Forces.velocityForce(0.00001, `multiply`);

Drag also reduces speed, and is based on the the square of the current velocity. We can use magnitudeForce . This produces a non-linear relation, compared with velocityForce. By passing dampen as the second parameter, we could reduce the force according the greater the mass - heavier object, less drag. Whether that makes any sense depends ont the dynamics you are creating.

const drag = Forces.magnitudeForce(0.1, `dampen`)