This commit is contained in:
2026-02-17 20:45:06 +02:00
parent b11e763fd9
commit 579e655981
+13 -6
View File
@@ -27,8 +27,12 @@ class DashBoard extends EventManager {
hud.add(hudTarget) hud.add(hudTarget)
hudTarget.position.set(0,0,0.52); hudTarget.position.set(0,0,0.52);
dash.visible = false; dash.visible = false;
const k = 1.55; const k = 3.11;
const dashWidth = engine.aspect * k, dashHeight = k; const dashWidth = engine.aspect * k, dashHeight = k;
const dashDistance = 2.5;
this.width = dashWidth;
this.height = dashHeight;
const dashGeometry = new PlaneGeometry(dashWidth, dashHeight); const dashGeometry = new PlaneGeometry(dashWidth, dashHeight);
const dashMesh = new Mesh(dashGeometry, new MeshBasicMaterial({ const dashMesh = new Mesh(dashGeometry, new MeshBasicMaterial({
@@ -112,7 +116,7 @@ class DashBoard extends EventManager {
dash.quaternion.copy(engine.camera.quaternion) dash.quaternion.copy(engine.camera.quaternion)
dash.position.copy(engine.camera.position) dash.position.copy(engine.camera.position)
//dash.translateZ(-1.2 * engine.camera.zoom); //dash.translateZ(-1.2 * engine.camera.zoom);
dash.translateZ(-0.75/Math.tan(engine.camera.fov/2 * Math.PI/180) * engine.camera.zoom); dash.translateZ(-dashDistance -0.75/Math.tan(engine.camera.fov/2 * Math.PI/180) * engine.camera.zoom);
}) })
this.initScene = function(scene, startBtnCallback){ this.initScene = function(scene, startBtnCallback){
@@ -198,6 +202,8 @@ class DashBoard extends EventManager {
//dashPlacement, rotate = false, plane = false //dashPlacement, rotate = false, plane = false
this.attach = (object, opts = {})=>{ this.attach = (object, opts = {})=>{
this.cameraFix = engine.hero.cameraZ;
engine.hero.cameraZ = 6;
hud.visible = true; hud.visible = true;
hudPlane.visible = !!opts.plane; hudPlane.visible = !!opts.plane;
if (opts.plane){ if (opts.plane){
@@ -232,7 +238,7 @@ class DashBoard extends EventManager {
a: opts.placement || { a: opts.placement || {
quaternion: { x:0, y:0, z:0, w:0 }, quaternion: { x:0, y:0, z:0, w:0 },
position: { x:0, y:0, z:0 }, position: { x:0, y:0, z:0 },
scale: { x: 1, y: 1, z: 1 } scale: { x: dashHeight * 0.8, y: dashHeight * 0.8, z: dashHeight * 0.8 }
}, },
t: opts.skipTransition ? 0 : 1, t: opts.skipTransition ? 0 : 1,
f: resolve f: resolve
@@ -245,7 +251,7 @@ class DashBoard extends EventManager {
a: { a: {
rotation: { y: 2*Math.PI } rotation: { y: 2*Math.PI }
}, },
t: 4, t: 8,
r: true, r: true,
d: 1 d: 1
}) })
@@ -254,6 +260,7 @@ class DashBoard extends EventManager {
} }
this.detach = (object, opts = {})=>{ this.detach = (object, opts = {})=>{
engine.hero.cameraZ = this.cameraFix;
//console.log('detaching', object) //console.log('detaching', object)
engine.motionQueue.remove(hudAnimation); engine.motionQueue.remove(hudAnimation);
object._hud.parent?.attach(object); object._hud.parent?.attach(object);
@@ -344,11 +351,11 @@ class SceneHeader{
startBtn.rotation.y = Math.PI/6; startBtn.rotation.y = Math.PI/6;
let title = await new TextObject(engine, { let title = await new TextObject(engine, {
position: [0, -0.22 * params.dashHeight,0], position: [0, -0.22 * params.dashHeight, -0.1],
fontSize: 0.055 * params.dashHeight, color: 0xffffff, outlineColor: 0x373737, outlineWidth: '3%' fontSize: 0.055 * params.dashHeight, color: 0xffffff, outlineColor: 0x373737, outlineWidth: '3%'
}); });
let description = await new TextObject(engine, { let description = await new TextObject(engine, {
position: [0, -0.25 * params.dashHeight,0], anchorY: 'top', lineHeight: 1.33, color: 0x0, position: [0, -0.25 * params.dashHeight, -0.1], anchorY: 'top', lineHeight: 1.33, color: 0x0,
fontSize: 0.025 * params.dashHeight, outlineWidth: '11%', maxWidth: params.dashWidth * 0.8 fontSize: 0.025 * params.dashHeight, outlineWidth: '11%', maxWidth: params.dashWidth * 0.8
}); });