xr
This commit is contained in:
@@ -144,7 +144,7 @@ export default {
|
|||||||
async loadEnvironment(scene, target){
|
async loadEnvironment(scene, target){
|
||||||
//await gameEngine.loadPanorama(`/asset/default/43.webp`);
|
//await gameEngine.loadPanorama(`/asset/default/43.webp`);
|
||||||
await this.expandScenarioData(scene);
|
await this.expandScenarioData(scene);
|
||||||
gameEngine.activeObjects.scale.set(0.033, 0.033, 0.033)
|
//gameEngine.activeObjects.scale.set(0.033, 0.033, 0.033)
|
||||||
target.objects = target.objects || {};
|
target.objects = target.objects || {};
|
||||||
let l = target.objects;
|
let l = target.objects;
|
||||||
if (this.scene.data.$environment.type == 'panorama2d'){
|
if (this.scene.data.$environment.type == 'panorama2d'){
|
||||||
|
|||||||
+18
-6
@@ -120,12 +120,20 @@ class GameEngine {
|
|||||||
}
|
}
|
||||||
if (gameEngine.xrController2?.gamepad){
|
if (gameEngine.xrController2?.gamepad){
|
||||||
let gp = gameEngine.xrController2.gamepad;
|
let gp = gameEngine.xrController2.gamepad;
|
||||||
if (gp.axes[3] != 0){
|
let gp1 = gameEngine.xrController1.gamepad;
|
||||||
let sc = gameEngine.scene.scale.x + gp.axes[3] * delta;
|
// if (gp.axes[3] != 0){
|
||||||
gameEngine.scene.scale.set(sc, sc, sc);
|
// let sc = gameEngine.scene.scale.x + gp.axes[3] * delta * 0.5;
|
||||||
}
|
// gameEngine.scene.scale.set(sc, sc, sc);
|
||||||
|
// }
|
||||||
if (gp.axes[2] != 0){
|
if (gp.axes[2] != 0){
|
||||||
gameEngine.scene.rotation.y += gp.axes[2] * delta;
|
if (gp1.buttons[4]?.pressed){
|
||||||
|
gameEngine.scene.position.y += gp.axes[2] * delta;
|
||||||
|
}else if (gp1.buttons[5]?.pressed){
|
||||||
|
let sc = gameEngine.scene.scale.x + gp.axes[2] * delta * 0.1;
|
||||||
|
gameEngine.scene.scale.set(sc, sc, sc);
|
||||||
|
}else{
|
||||||
|
gameEngine.scene.rotation.y += gp.axes[2] * delta * 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameEngine.render(scene, gameEngine.camera);
|
gameEngine.render(scene, gameEngine.camera);
|
||||||
@@ -172,7 +180,11 @@ class GameEngine {
|
|||||||
if (opts.xr){
|
if (opts.xr){
|
||||||
renderer.xr.enabled = true;
|
renderer.xr.enabled = true;
|
||||||
document.body.appendChild( XRButton.createButton( renderer, {
|
document.body.appendChild( XRButton.createButton( renderer, {
|
||||||
'optionalFeatures': [ 'depth-sensing' ]
|
'optionalFeatures': [ 'depth-sensing' ],
|
||||||
|
depthSensing: {
|
||||||
|
usagePreference: ["cpu-optimized", "gpu-optimized"],
|
||||||
|
dataFormatPreference: ["luminance-alpha", "float32"],
|
||||||
|
},
|
||||||
} ) );
|
} ) );
|
||||||
this.initXrControllers();
|
this.initXrControllers();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user