This commit is contained in:
@@ -26,7 +26,7 @@ class DashBoard extends EventManager {
|
|||||||
dash.renderOrder = 1000;
|
dash.renderOrder = 1000;
|
||||||
const k = 3.11;
|
const k = 3.11;
|
||||||
const dashWidth = engine.aspect * k, dashHeight = k;
|
const dashWidth = engine.aspect * k, dashHeight = k;
|
||||||
const dashDistance = 1.77;
|
const dashDistance = 0.11;
|
||||||
|
|
||||||
this.width = dashWidth;
|
this.width = dashWidth;
|
||||||
this.height = dashHeight;
|
this.height = dashHeight;
|
||||||
@@ -114,11 +114,13 @@ class DashBoard extends EventManager {
|
|||||||
pointsText.position.set(0.86 * dashWidth/2, 0.47 * dashHeight, -0.001);
|
pointsText.position.set(0.86 * dashWidth/2, 0.47 * dashHeight, -0.001);
|
||||||
dash.add(pointsText);
|
dash.add(pointsText);
|
||||||
|
|
||||||
//engine.addEventListener('beforeRender', ()=>{
|
this.orient = function(){
|
||||||
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(-dashDistance -0.75/Math.tan(engine.camera.fov/2 * Math.PI/180) * engine.camera.zoom);
|
dash.translateZ(-dashDistance -(dashHeight/2)/Math.tan(engine.camera.fov/2 * Math.PI/180) * engine.camera.zoom);
|
||||||
//})
|
}
|
||||||
|
|
||||||
|
this.orient();
|
||||||
|
|
||||||
this.pointer = new Mesh(
|
this.pointer = new Mesh(
|
||||||
new RingGeometry(dashHeight * 0.002, dashHeight * 0.005),
|
new RingGeometry(dashHeight * 0.002, dashHeight * 0.005),
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ function onMouseWheel( event ){
|
|||||||
if (this.engine.camera.fov >= 45){
|
if (this.engine.camera.fov >= 45){
|
||||||
this.unlock();
|
this.unlock();
|
||||||
}
|
}
|
||||||
|
this.engine.dashboard?.orient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +221,9 @@ function onPointerlockChange() {
|
|||||||
this.isLocked = false;
|
this.isLocked = false;
|
||||||
this.dispatchEvent( { type: 'unlock' } );
|
this.dispatchEvent( { type: 'unlock' } );
|
||||||
}
|
}
|
||||||
|
this.engine.camera.fov = 45;
|
||||||
|
this.engine.camera.updateProjectionMatrix();
|
||||||
|
this.engine.dashboard?.orient();
|
||||||
//this.engine.cameraRig.rotation.y = this.isLocked ? 0 : Math.PI;
|
//this.engine.cameraRig.rotation.y = this.isLocked ? 0 : Math.PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user