TA159

Notas, resueltos y trabajos practicos de la materia Sistemas Gráficos
Index Commits Files Refs Submodules README LICENSE
commit 31d661d2569d27b998d37caabf2fea8b7f362965
parent 0bb69136b917e2322b5328721b3e88e8bc6ff1fa
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Mon,  8 Jul 2024 12:03:13 -0300

fix train crank position

Diffstat:
Mtp/src/standalone/train.js | 12++++++------
Mtp/src/train.js | 14+++++++-------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tp/src/standalone/train.js b/tp/src/standalone/train.js
@@ -65,8 +65,8 @@ const wheelThickness = 0.425;
 const chassisOffset = 1.245;
 const wheelOffset = -0.45;
 const steamCylindersLen = 4;
-const crankLen = 10;
-const crankOffset = 0.60;
+const crankLen = 12;
+const crankOffset = 1.55;
 const crankWidth = 0.25;
 
 let crankLeft, crankRight;
@@ -383,12 +383,12 @@ function mainLoop() {
     requestAnimationFrame(mainLoop);
 
     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 + 0.50*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.50*(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 + 0.50*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.50*(Math.cos(time*Math.PI/2)));
 
     renderer.render(scene, camera);
 }
diff --git a/tp/src/train.js b/tp/src/train.js
@@ -15,8 +15,8 @@ const wheelThickness = 0.425;
 const chassisOffset = 1.245;
 const wheelOffset = -0.45;
 const steamCylindersLen = 4;
-const crankLen = 10;
-const crankOffset = 0.60;
+const crankLen = 12;
+const crankOffset = 1.55;
 const crankWidth = 0.25;
 
 let crankLeft, crankRight;
@@ -269,7 +269,7 @@ export function buildTrain() {
     a2.add(w3);
 
     const w4 = buildTrainWheel();
-    w4.position.set(-steamChamberRad+wheelThickness/2.1,0,);
+    w4.position.set(-steamChamberRad+wheelThickness/2.1,0,0);
     a2.add(w4);
 
     const w5 = buildTrainWheel();
@@ -317,10 +317,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 + 0.50*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.50*(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 + 0.50*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.50*(Math.cos(time*Math.PI/2)));
 }