From cb6407e76eaf94b75b4c8c71c2e4e027fb26e691 Mon Sep 17 00:00:00 2001
From: Kevin Lee <kevin@infinite-lee.com>
Date: Wed, 21 Feb 2018 17:03:51 -0800
Subject: [PATCH] cleanup and reorganization of room.hbs

---
 templates/room.hbs | 61 ++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/templates/room.hbs b/templates/room.hbs
index da9f0cb8d..538303652 100644
--- a/templates/room.hbs
+++ b/templates/room.hbs
@@ -117,30 +117,44 @@
                     scale="6 6 6"
                 ></a-entity>
             </script>
+
             <script id="physics-cube" type="text/html">
-                <a-box class="collidable" remote-dynamic-body="counter: #counter" physics-collider scale="0.25 0.25 0.25"  material="color: green"></a-box>
+                <a-box 
+                    class="collidable" 
+                    remote-dynamic-body="counter: #counter"
+                     scale="0.25 0.25 0.25"
+                    material="color: green"
+                ></a-box>
             </script>
+
+            <a-mixin id="super-hands"
+                super-hands="colliderEvent: collisions; colliderEventProperty: els;
+                    colliderEndEvent: collisions; colliderEndEventProperty: clearedEls;
+                    grabStartButtons: action_grab; grabEndButtons: action_release;
+                    stretchStartButtons: action_grab; stretchEndButtons: action_release;
+                    dargDropStartButtons: action_grab; dragDropEndButtons: action_release;
+                    "
+                collision-filter="collisionForces: false"
+                physics-collider
+            ></a-mixin>
         </a-assets>
 
         <a-entity id="counter" networked-counter="max: 3; ttl: 120"></a-entity>
 
-        <a-entity id="cube-spawner" super-spawner="template: #physics-cube; spawn_position: 2.5 1.2 0;" position="2.5 1.2 0" >
-            <a-box material="color: blue" class="collidable" physics-collider scale="0.25 0.25 0.25"></a-box>
+        <a-entity 
+            id="cube-spawner" 
+            super-spawner="template: #physics-cube; spawn_position: 2.5 1.2 0;" 
+            position="2.5 1.2 0" 
+        >
+            <a-box material="color: blue" class="collidable" scale="0.25 0.25 0.25"></a-box>
         </a-entity>
 
         <a-sphere
             id="3d-cursor"
             material="color: #00EFFF"
             radius=0.02
-            physics-collider
-            collision-filter="collisionForces: false"
             static-body="shape: sphere;"
-            super-hands="colliderEvent: collisions; colliderEventProperty: els;
-                         colliderEndEvent: collisions; colliderEndEventProperty: clearedEls;
-                         grabStartButtons: action_grab; grabEndButtons: action_release;
-                         stretchStartButtons: action_grab; stretchEndButtons: action_release;
-                         dargDropStartButtons: action_grab; dragDropEndButtons: action_release;
-                         "
+            mixin="super-hands"
         ></a-sphere>  
 
         <!-- Player Rig -->
@@ -153,14 +167,14 @@
         >
             <a-entity
                 id="head"
-                camera="userHeight: 1.6"
+                camera
                 personal-space-bubble
                 look-controls
                 networked="template: #head-template; showLocalTemplate: false;"
             >
             <a-entity
                 cursor-hand="cursor: #3d-cursor"
-                position="0 -0.1 0"
+                position="0 0 0"
                 raycaster="objects: .collidable; direction: 0 0 -1; recursive: false;"
             ></a-entity>
             </a-entity>
@@ -181,16 +195,8 @@
                 haptic-feedback
                 teleport-controls="cameraRig: #player-rig; teleportOrigin: #head; button: action_teleport_"
                 networked="template: #left-hand-template;"
-
-                physics-collider
-                collision-filter="collisionForces: false"
                 static-body="shape: sphere; sphereRadius: 0.02"
-                super-hands="colliderEvent: collisions; colliderEventProperty: els;
-                             colliderEndEvent: collisions; colliderEndEventProperty: clearedEls;
-                             grabStartButtons: action_grab; grabEndButtons: action_release;
-                             stretchStartButtons: action_grab; stretchEndButtons: action_release;
-                             dargDropStartButtons: action_grab; dragDropEndButtons: action_release;
-                             "
+                mixin="super-hands"
             >
                 <a-entity
                     id="watch"
@@ -211,16 +217,7 @@
                                     hitEntity: #telepor-indicator;
                                     button: action_teleport_;"
                 networked="template: #right-hand-template;"
-
-                physics-collider
-                collision-filter="collisionForces: false"
-                static-body="shape: sphere; sphereRadius: 0.02"
-                super-hands="colliderEvent: collisions; colliderEventProperty: els;
-                             colliderEndEvent: collisions; colliderEndEventProperty: clearedEls;
-                             grabStartButtons: action_grab; grabEndButtons: action_release;
-                             stretchStartButtons: action_grab; stretchEndButtons: action_release;
-                             dargDropStartButtons: action_grab; dragDropEndButtons: action_release;
-                             "
+                mixin="super-hands"
             ></a-entity>
         </a-entity>
 
-- 
GitLab