-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: janusweb
action: commit
revision:
path_from:
revision_from: 1c7055feefcf4c000ec8b26c997b66da27422d2d:
path_to:
revision_to:

git.thebackupbox.net

janusweb

git://git.thebackupbox.net/janusweb

commit 1c7055feefcf4c000ec8b26c997b66da27422d2d
Author: James Baicoianu <james_github@baicoianu.com>
Date:   Fri Jun 12 23:39:25 2020 -0700

    WebXR fixes

diff --git a/scripts/janusxrplayer.js b/scripts/janusxrplayer.js

index 721b48deffbcdb566795e1a6d0edba935bc7552e..

index ..84c35398e8da4814f8c37370c0c4256d55de8601 100644

--- a/scripts/janusxrplayer.js
+++ b/scripts/janusxrplayer.js
@@ -17,6 +17,22 @@ elation.require(['engine.things.generic'], function() {
       };

     }
+    this.setSession = function(session) {
+      this.session = session;
+      console.log('xr player session changed', this.session);
+      this.inputs = {};
+      if (session) {
+        session.addEventListener('inputsourceschange', (ev) => { this.processInputSources(this.session.inputSources);});
+      } else {
+        this.resetOrientation();
+      }
+    }
+    this.resetOrientation = function() {
+        player.pos.copy(this.position);
+        //player.orientation.copy(this.orientation);
+        player.head.orientation.set(0,0,0,1);
+        player.head.position.set(0,0,0);
+    }
     this.processInputSources = function(inputs) {
       for (let i = 0; i < inputs.length; i++) {
         let input = inputs[i];
@@ -47,6 +63,10 @@ elation.require(['engine.things.generic'], function() {
           this.trackedobjects[id].visible = false;
         }
       }
+      player.pos.copy(this.position);
+      //player.orientation.copy(this.orientation);
+      player.head.orientation.copy(this.trackedobjects['head'].orientation);
+      player.head.position.copy(this.trackedobjects['head'].position)
       this.dispatchEvent({type: 'xrframe', data: xrReferenceFrame});
     }
     this.getReferenceFrame = function() {
@@ -103,6 +123,7 @@ elation.require(['engine.things.generic'], function() {
     janus.registerElement('trackedplayer_head', {
       device: null,
       create() {
+/*
         this.headmodel = this.createObject('object', {
           id: 'sphere',
           //collision_id: 'sphere',
@@ -123,6 +144,7 @@ elation.require(['engine.things.generic'], function() {
           scale: V(.15, .05, .05),
           pos: V(0, -.05, -.075)
         });
+*/
       },
       updatePose(pose) {
         if (pose) {

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 15:16:22 2024