TA159

Notas, resueltos y trabajos practicos de la materia Sistemas Gráficos
Index Commits Files Refs Submodules README LICENSE
commit 6326ad339dac7f614780c679fe0366ab32132be5
parent 918088b2afbb6666d64d90e52dd7d280112e9bae
Author: Martin Klöckner <mjkloeckner@gmail.com>
Date:   Sat, 29 Jun 2024 13:43:21 -0300

fix train animation

Diffstat:
Mtp/src/rails.js | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tp/src/rails.js b/tp/src/rails.js
@@ -26,7 +26,7 @@ export function getRailsPathPosAt(t) {
     if(railsPath == undefined) {
         console.log("railsPath is undefined");
     }
-    return railsPath.getPointAt(t);
+    return [railsPath.getPointAt(t), railsPath.getTangentAt(t)];
 }
 
 function parametricRailsFoundationFunction(u, v, target) {
@@ -38,6 +38,7 @@ function parametricRailsFoundationFunction(u, v, target) {
     let railsFoundationShapePos = railsFoundationShape.getPointAt(u);
     // TODO: make `railsFoundationShape` smaller and remove this multiplication
     railsFoundationShapePos.multiplyScalar(0.5);
+    railsFoundationShapePos.x *= 1.25;
 
     let tangente = new THREE.Vector3();
     let binormal = new THREE.Vector3();
@@ -131,10 +132,10 @@ export function buildRailsGeometry(railsRadius = 0.35) {
     let railsGeometries = [];
 
     const leftRailGeometryFunction  = getParametricRailsFunction(railsRadius,
-        new THREE.Vector3( 6, 0, railsRadius+8));
+        new THREE.Vector3( 9.5, 0, railsRadius+8));
 
     const rightRailGeometryFunction = getParametricRailsFunction(railsRadius,
-        new THREE.Vector3(-6, 0, railsRadius+8));
+        new THREE.Vector3(-9.5, 0, railsRadius+8));
 
     const leftRailGeometry  = new ParametricGeometry(leftRailGeometryFunction, 100, 500);
     const rightRailGeometry = new ParametricGeometry(rightRailGeometryFunction, 100, 500);