This commit is contained in:
2026-03-18 20:22:45 +02:00
parent 6bc5b533ac
commit 691ec08e88
3 changed files with 12 additions and 12 deletions
@@ -77,7 +77,6 @@ class VideoPlayer extends EventManager {
}
resolve(this);
console.log('VI', vi)
})
vi.src = engine.assetPath + data.$go.asset.name;
})
+2 -1
View File
@@ -98,7 +98,8 @@ class DashBoard extends EventManager {
clipRect: [-dashWidth * 0.4, -0.12 * dashHeight, dashWidth * 0.4, 0]
})
text.sync();
text.position.set(0, -0.27 * dashHeight, 0.001);
text.position.set(0, -0.27 * dashHeight, 0.003);
text.renderOrder = 1001;
text.material.depthTest = false;
dash.add(text);
+10 -10
View File
@@ -108,6 +108,7 @@ class Hero{
this.ready = true;
this.camera.rotation.reorder('YZX');
this.engine.camera.rotation.reorder('YZX');
this.model.rotation.reorder('YZX');
}
update(delta){
@@ -124,6 +125,7 @@ class Hero{
}else if (this.engine.renderer.xr.isPresenting){
this.cameraMode = 'rotate'
this.engine.cameraRig.position.y = - this.engine.camera.position.y;
this.engine.dashboard.object.position.y = this.engine.camera.position.y;
}else{
this.cameraMode = 'rotate'
this.engine.cameraRig.position.y = 0;
@@ -220,11 +222,11 @@ class Hero{
}
if (pc.moveCloser){
this.cameraZ += delta;
this.cameraZ += delta*7;
}
if (pc.moveAway){
this.cameraZ -= delta;
this.cameraZ -= delta*7;
}
if (pc.motion){
@@ -232,22 +234,19 @@ class Hero{
//this.directionVelocity = this.directionVelocity * 2.5 * Math.abs(input[0])
this.direction += input[0] * delta * 2.5 //this.directionVelocity;
this.walkDirection.set(0, 0, input[1])
this.walkDirection.applyAxisAngle(this.rotateAngle, this.direction)
}else{
if (this.engine.renderer.xr.isPresenting){
this.direction = this.engine.camera.rotation.y;
}else{
this.direction = this.camera.rotation.y;
}
this.walkDirection.set(input[0], 0, input[1])
this.walkDirection.applyAxisAngle(this.rotateAngle, this.direction)
//console.log(this.camera.rotation.y * 180/Math.PI);
// this.camera.getWorldDirection(this.walkDirection);
// this.walkDirection.applyAxisAngle(this.rotateAngle, input[0]*Math.PI/2 + (input[1]<0 ? Math.PI : 0))
//this.walkDirection.multiplyScalar(input[1]);
}
this.walkDirection.applyAxisAngle(this.rotateAngle, this.direction)
this.walkDirection.normalize();
this.model.rotation.y = this.direction;
}
@@ -285,9 +284,9 @@ class Hero{
let cameraDesiredPosition;
if (this.cameraMode == 'rotate'){
cameraDesiredPosition = new Vector3(
this.model.position.x + this.cameraZ* Math.sin(this.model.rotation.y + Math.PI + this.cameraDelta + this.cameraIdleDelta),
this.model.position.x + this.#cameraZ* Math.sin(this.model.rotation.y + Math.PI + this.cameraDelta + this.cameraIdleDelta),
this.model.position.y + this.cameraY,
this.model.position.z + this.cameraZ* Math.cos(this.model.rotation.y + Math.PI + this.cameraDelta + this.cameraIdleDelta)
this.model.position.z + this.#cameraZ* Math.cos(this.model.rotation.y + Math.PI + this.cameraDelta + this.cameraIdleDelta)
)
} else {
// cameraDesiredPosition = new Vector3(
@@ -296,13 +295,14 @@ class Hero{
// this.model.position.z - this.#cameraZ
// )
cameraDesiredPosition = new Vector3(
this.model.position.x + this.cameraZ* Math.sin(0+ Math.PI + this.cameraDelta + this.cameraIdleDelta),
this.model.position.x + this.#cameraZ* Math.sin(0+ Math.PI + this.cameraDelta + this.cameraIdleDelta),
this.model.position.y + this.cameraY,
this.model.position.z + this.cameraZ* Math.cos(0+ Math.PI + this.cameraDelta + this.cameraIdleDelta)
this.model.position.z + this.#cameraZ* Math.cos(0+ Math.PI + this.cameraDelta + this.cameraIdleDelta)
)
}
cameraPosition.lerp(cameraDesiredPosition, this.cameraMode == 'fixed' ? delta*2 : delta*2)
//cameraPosition.lerp(cameraDesiredPosition, this.fpv ? 1 : delta*2)
this.camera.position.copy(cameraPosition)
if (!this.fpv){
this.camera.lookAt(