repo: janusweb action: commit revision: path_from: revision_from: 094691bf60a551a250b0a305a400d2734ea1c816: path_to: revision_to:
commit 094691bf60a551a250b0a305a400d2734ea1c816 Author: James BaicoianuDate: Sun Sep 10 01:00:15 2023 -0700 Toggle XR menu attachment diff --git a/scripts/janusxrplayer.js b/scripts/janusxrplayer.js
--- a/scripts/janusxrplayer.js
+++ b/scripts/janusxrplayer.js
@@ -265,6 +265,10 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
pos: menupos,
rotation: menurot,
});
+ this.menupos = menupos;
+ this.menurot = menurot;
+ this.removeChild(this.menu);
+
player.setHand(this.device.handedness, this.virtualskeleton);
},
updateDevice(device) {
@@ -395,6 +399,25 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
this.pointer.orientation.copy(raypose.transform.orientation);
this.pointer.updateCursorOpacity();
}
+ if (this.gamepad && this.gamepad.buttons && this.gamepad.buttons[4]) {
+ let button = this.gamepad.buttons[4];
+ if (button.pressed) {
+ this.buttonwaspressed = true;
+ } else if (this.buttonwaspressed && !button.pressed) {
+ this.buttonwaspressed = false;
+ if (!this.menu.parent || this.menu.parent === this) {
+ player.appendChild(this.menu);
+ player.worldToLocal(this.pointer.localToWorld(this.menu.pos.set(0,0,-.25)));
+ this.menu.billboard = 'y';
+ } else {
+ //this.appendChild(this.menu);
+ player.removeChild(this.menu);
+ this.menu.billboard = '';
+ this.menu.pos.copy(this.menupos);
+ //this.menu.visible = false;
+ }
+ }
+ }
},
createButtons() {
if (this.device) {
@@ -784,7 +807,7 @@ elation.require(['engine.things.generic', 'janusweb.external.webxr-input-profile
col: 'green'
});
this.tmpobj = new THREE.Object3D();
- this.joints = new THREE.InstancedMesh(new THREE.SphereBufferGeometry(1), new THREE.MeshPhysicalMaterial({color: 0xccffcc, metalness: .2, roughness: .5}), 26);
+ this.joints = new THREE.InstancedMesh(new THREE.SphereGeometry(1), new THREE.MeshPhysicalMaterial({color: 0xccffcc, metalness: .2, roughness: .5}), 26);
this.joints.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
this.jointposes = {};
this.objects['3d'].add(this.joints);
-----END OF PAGE-----