From 88f79598533f3d1e0a78fcc4d062582d292327cb Mon Sep 17 00:00:00 2001
From: netpro2k <netpro2k@gmail.com>
Date: Fri, 20 Apr 2018 11:43:22 -0700
Subject: [PATCH] Hack to remove hand states and monkeypatch PannerNode - This
 should be reverted before this lands on master

---
 src/hub.js             |  3 ++-
 src/network-schemas.js | 20 ++++++++++----------
 src/utils/webgl.js     | 12 ++++++++++++
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/hub.js b/src/hub.js
index e452bb2d4..64d4f2a4e 100644
--- a/src/hub.js
+++ b/src/hub.js
@@ -4,8 +4,9 @@ import uuid from "uuid/v4";
 import queryString from "query-string";
 import { Socket } from "phoenix";
 
-import { patchWebGLRenderingContext } from "./utils/webgl";
+import { patchWebGLRenderingContext, monkeyPatchPannerNode } from "./utils/webgl";
 patchWebGLRenderingContext();
+monkeyPatchPannerNode();
 
 import "aframe-xr";
 import "./vendor/GLTFLoader";
diff --git a/src/network-schemas.js b/src/network-schemas.js
index 822951bed..2e24083d2 100644
--- a/src/network-schemas.js
+++ b/src/network-schemas.js
@@ -9,16 +9,16 @@ function registerNetworkSchemas() {
       },
       "scale",
       "player-info",
-      {
-        selector: ".RootScene",
-        component: "hand-pose__left",
-        property: "pose"
-      },
-      {
-        selector: ".RootScene",
-        component: "hand-pose__right",
-        property: "pose"
-      },
+      // {
+      //   selector: ".RootScene",
+      //   component: "hand-pose__left",
+      //   property: "pose"
+      // },
+      // {
+      //   selector: ".RootScene",
+      //   component: "hand-pose__right",
+      //   property: "pose"
+      // },
       {
         selector: ".camera",
         component: "position"
diff --git a/src/utils/webgl.js b/src/utils/webgl.js
index b9cbe9c6c..92e95ac0c 100644
--- a/src/utils/webgl.js
+++ b/src/utils/webgl.js
@@ -33,3 +33,15 @@ export function patchWebGLRenderingContext() {
   }
   WebGLRenderingContext.prototype.getExtension = patchedGetExtension;
 }
+
+// HACK: THIS SHOULD NOT GET MERGED TO MASTER
+export function monkeyPatchPannerNode() {
+  const setPosition = PannerNode.prototype.setPosition;
+  PannerNode.prototype.setPosition = function(x, y, z) {
+    if (isNaN(x) || isNaN(y) || isNaN(z)) {
+      console.error("PannerNode.setPosition caled with invalid position", x, y, z);
+    } else {
+      setPosition.call(this, x, y, z);
+    }
+  };
+}
-- 
GitLab