diff --git a/app/(core)/data/configs/SimplePendulum.js b/app/(core)/data/configs/SimplePendulum.js index 3eef52f..e3f9e82 100644 --- a/app/(core)/data/configs/SimplePendulum.js +++ b/app/(core)/data/configs/SimplePendulum.js @@ -91,7 +91,7 @@ export const SimInfoMapper = (bodyState) => { return { Angle: `${angle.toFixed(1)}°`, "Angular Velocity": `${bodyState.angularVel.toFixed(2)} rad/s`, - Height: `${(-bodyState.position.y).toFixed(2)} m`, + Height: `${bodyState.height.toFixed(2)} m`, Speed: `${bodyState.velocity.mag().toFixed(2)} m/s`, KE: `${bodyState.kineticEnergy.toFixed(2)} J`, PE: `${bodyState.potentialEnergy.toFixed(2)} J`, diff --git a/simulations/SimplePendulum.jsx b/simulations/SimplePendulum.jsx index 8b1094d..10b0d16 100644 --- a/simulations/SimplePendulum.jsx +++ b/simulations/SimplePendulum.jsx @@ -292,6 +292,9 @@ export default function Pendulum() { velocity: bodyRef.current.state.velocity, angularVel: bodyRef.current.angularVel, angleRad: bodyRef.current.getAngle(), + height: + bodyRef.current.state.position.y - + (bodyRef.current.anchor.y - bodyRef.current.length), kineticEnergy: bodyRef.current.getKineticEnergy(), potentialEnergy: bodyRef.current.getPotentialEnergy( inputsRef.current.gravity