commit 80740ed4e8ee2989ed7a50c9a11fd54534640fbe
parent ef2dacdd2d49be1e1bbd2f066bc5b3dd7acfa548
Author: Martin Klöckner <mjkloeckner@gmail.com>
Date: Sat, 29 Jun 2024 00:02:05 -0300
`updateTrainCrankPosition`: map the argument [0.00 to 1.00] to the whole rotation
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tp/src/train.js b/tp/src/train.js
@@ -302,10 +302,10 @@ export function buildTrain() {
export function updateTrainCrankPosition(time = 0.0) {
crankLeft.position.set(-steamChamberRad-crankWidth/2,
- wheelOffset+1.00*(Math.sin(time*Math.PI/2)),
- crankOffset - 1.00*(Math.cos(time*Math.PI/2)));
+ wheelOffset+1.00*(Math.sin(time*Math.PI*2)),
+ crankOffset - 1.00*(Math.cos(time*Math.PI*2)));
crankRight.position.set(steamChamberRad+crankWidth/2,
- wheelOffset+1.00*(Math.sin(time*Math.PI/2)),
- crankOffset - 1.00*(Math.cos(time*Math.PI/2)));
+ wheelOffset+1.00*(Math.sin(time*Math.PI*2)),
+ crankOffset - 1.00*(Math.cos(time*Math.PI*2)));
}