commit 6afa2b9eadbe0facf2b090a2d787cecf0aa83f9f
parent 1c9cd1b97a49cd9d268dbc95f1e7d452af7cde53
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Thu, 4 Jul 2024 19:39:38 -0300
fix bridge texture flickering and reduce raycasting position above camera
Diffstat:
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tp/src/bridge.js b/tp/src/bridge.js
@@ -281,9 +281,9 @@ export function generateBridge(arcCount=1, arcRadius=3,
const bridgeCage = new THREE.Mesh(cageGeometry, cageMaterial);
bridge.add(bridgeCage);
- const roadwayFloorGeometry = new THREE.PlaneGeometry(
- bridgeWidth+bridgeWallThickness,
- bridgeLen);
+ const roadwayFloorGeometry = new THREE.BoxGeometry(
+ bridgeWidth+bridgeWallThickness+0.01,
+ bridgeLen+0.01, 0.10);
roadwayFloorGeometry.rotateZ(Math.PI/2)
roadwayFloorGeometry.rotateX(Math.PI/2)
diff --git a/tp/src/scene.js b/tp/src/scene.js
@@ -335,7 +335,7 @@ function buildBridge() {
// bridge1.rotateY(-Math.PI*0.118);
bridge2.scale.set(0.5, 0.5, 0.5);
- bridge2.position.set(-14, 0, -41);
+ bridge2.position.set(-14, -0.25, -41);
// bridge2.rotateY(-Math.PI*0.118);
const bridgeCamera = new THREE.PerspectiveCamera(
@@ -588,7 +588,7 @@ function mainLoop() {
raycaster = new THREE.Raycaster();
var raycasterPos = new THREE.Vector3();
raycasterPos.copy(firstPersonControls.getObject().position)
- raycasterPos.y += 10;
+ raycasterPos.y += 2;
var raycasterDir = new THREE.Vector3(0, -1, 0);
raycaster.set(raycasterPos, raycasterDir);
diff --git a/tp/src/standalone/bridge.js b/tp/src/standalone/bridge.js
@@ -303,9 +303,9 @@ function generateBridge() {
const bridgeCage = new THREE.Mesh(cageGeometry, cageMaterial);
scene.add(bridgeCage);
- const roadwayFloorGeometry = new THREE.PlaneGeometry(
+ const roadwayFloorGeometry = new THREE.BoxGeometry(
bridgeWidth+bridgeWallThickness,
- bridgeLen);
+ bridgeLen, 0.5);
roadwayFloorGeometry.rotateZ(Math.PI/2)
roadwayFloorGeometry.rotateX(Math.PI/2)