This commit is contained in:
2026-03-15 15:54:02 +02:00
parent 78705e276e
commit 95c878e979
2 changed files with 40 additions and 5 deletions
+16 -5
View File
@@ -95,13 +95,16 @@ class Hero{
this.updateCharacterControls(delta)
if (this.engine.renderer.xr.isPresenting){
this.cameraMode = 'fixed'
this.cameraY = this.size.y * 1;
this.engine.cameraRig.position.y = -this.engine.camera.position.y;
this.engine.dashboard.object.position.y = this.engine.camera.position.y;
//this.cameraY = this.size.y * 1;
//this.camera = this.engine.cameraWorld;
// this.engine.activeObjects.position.x = -this.camera.position.x;
// this.engine.activeObjects.position.z = -this.camera.position.z;
}else{
this.cameraMode = 'rotate'
this.cameraY = this.size.y * 1.5;
this.engine.cameraRig.position.y = 0;
//this.cameraY = this.size.y * 1.5;
// this.camera = this.engine.cameraWorld;
// this.engine.camera.position.set(0,0,0);
// this.engine.camera.rotation.set(0,0,0);
@@ -109,7 +112,7 @@ class Hero{
}
}
destroy(){
dispose(){
delete this.engine.hero;
this.engine.mixers.splice(this.engine.mixers.indexOf(this.mixer), 1);
}
@@ -187,13 +190,21 @@ class Hero{
this.cameraDelta += delta * ( pc.cameraLeft * -1 + pc.cameraRight * 1)
this.walkDirection.setScalar(0);
if (pc.kb.KeyR && this.cameraY < 5){
if (pc.cameraUp && this.cameraY < 5){
this.cameraY+=delta;
}
if (pc.kb.KeyF && this.cameraY > 1){
if (pc.cameraDown && this.cameraY > 1){
this.cameraY-=delta;
}
if (pc.moveCloser){
this.cameraZ+=delta;
}
if (pc.moveAway){
this.cameraZ-=delta;
}
if (pc.motion){
if (!pc.isLocked){
//this.directionVelocity = this.directionVelocity * 2.5 * Math.abs(input[0])
+24
View File
@@ -100,6 +100,18 @@ class PointerControls extends Controls {
return this.kb['ArrowRight'] || this.kb['KeyD'] || this.engine.xrController1?.gamepad?.axes[2] > 0.5 || false
}
get moveAway(){
return this.kb.KeyT ||
(this.engine.xrController2?.gamepad?.axes[3] < -0.5 && !this.engine.xrController1?.gamepad?.buttons[4]?.pressed)
|| false
}
get moveCloser(){
return this.kb.KeyG ||
(this.engine.xrController2?.gamepad?.axes[3] > 0.5 && !this.engine.xrController1?.gamepad?.buttons[4]?.pressed )
|| false
}
get rotateLeft(){
return this.moveLeft;
}
@@ -124,6 +136,18 @@ class PointerControls extends Controls {
return this.kb['KeyE'] || this.engine.xrController2?.gamepad?.axes[2] < -0.5 || false
}
get cameraUp(){
return this.kb.KeyR ||
(this.engine.xrController2?.gamepad?.axes[3] < -0.5 && this.engine.xrController1?.gamepad?.buttons[4]?.pressed)
|| false
}
get cameraDown(){
return this.kb.KeyF ||
(this.engine.xrController2?.gamepad?.axes[3] > 0.5 && this.engine.xrController1?.gamepad?.buttons[4]?.pressed)
|| false
}
get moving(){
return this.moveForward || this.moveBackward || this.moveLeft || this.moveRight;
}