commit 0cf7624f6860a261b5f1eb02dc6125d16c5a2385
parent 3f6dd7979528ad32c06f34d29563fd0826788345
Author: Martin J. Klöckner <mjkloeckner@gmail.com>
Date: Sat, 29 Jun 2024 13:45:02 -0300
Merge pull request #2 from mjkloeckner/tp
fix train animation
Diffstat:
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);