TA159

Notas, resueltos y trabajos practicos de la materia Sistemas Gráficos
Index Commits Files Refs Submodules README LICENSE
commit 6e2641f555d0d672025a5f87418436e3f4d29999
parent 55de57fb3a16d7b2b0a1dc09369fd1fa526980d8
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Tue,  9 Jul 2024 23:50:32 -0300

set proper train crank size and offset

Diffstat:
Mtp/src/standalone/train.js | 12++++++------
Mtp/src/train.js | 12++++++------
2 files changed, 12 insertions(+), 12 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.50;
 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.70*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.70*(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.70*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.70*(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.50;
 const crankWidth = 0.25;
 
 let crankLeft, crankRight;
@@ -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.70*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.70*(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.70*(Math.sin(time*Math.PI/2)),
+        crankOffset - 0.70*(Math.cos(time*Math.PI/2)));
 }