diff --git a/app/(core)/physics/ForceRenderer.js b/app/(core)/physics/ForceRenderer.js index f603cad..75386dc 100644 --- a/app/(core)/physics/ForceRenderer.js +++ b/app/(core)/physics/ForceRenderer.js @@ -110,7 +110,8 @@ export class ForceRenderer { let labelText = text; if (showMag && magnitude !== undefined) { - labelText = `${text} (${magnitude.toFixed(1)}N)`; + const unit = options.unit ?? "N"; + labelText = `${text} (${magnitude.toFixed(1)}${unit})`; } p.push(); diff --git a/simulations/BallAcceleration.jsx b/simulations/BallAcceleration.jsx index 272cc0e..816848c 100644 --- a/simulations/BallAcceleration.jsx +++ b/simulations/BallAcceleration.jsx @@ -222,7 +222,8 @@ export default function BallAcceleration() { accelerationForce.x / bodyRef.current.params.mass, -(accelerationForce.y / bodyRef.current.params.mass), "#ef4444", - "Acceleration" + "Acceleration", + { unit: "m/s²" } ); } diff --git a/simulations/BallGravity.jsx b/simulations/BallGravity.jsx index d232d95..2e6f5bc 100644 --- a/simulations/BallGravity.jsx +++ b/simulations/BallGravity.jsx @@ -226,7 +226,7 @@ export default function BallGravity() { kineticEnergy: bodyRef.current.getKineticEnergy(), potentialEnergy: bodyRef.current.getPotentialEnergy( gravity, - toMeters(p.height) + size / 2 ), }, {