From 7cd178fa8c6be3400b3a8f994283ef00d4075825 Mon Sep 17 00:00:00 2001
From: Robert Long <robert@robertlong.me>
Date: Fri, 11 May 2018 16:05:24 -0700
Subject: [PATCH] Avoid duplicate updateMatrixWorld call in cursor-controller.

---
 src/components/cursor-controller.js | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/components/cursor-controller.js b/src/components/cursor-controller.js
index 7ae7aa529..d3d43b4f2 100644
--- a/src/components/cursor-controller.js
+++ b/src/components/cursor-controller.js
@@ -151,12 +151,18 @@ AFRAME.registerComponent("cursor-controller", {
       this.direction.copy(raycaster.ray.direction);
     } else if ((this.inVR || this.isMobile) && !this.hasPointingDevice) {
       //gaze cursor mode
-      camera.getWorldPosition(this.origin);
-      camera.getWorldDirection(this.direction);
+      camera.updateMatrixWorld(true);
+      this.origin.setFromMatrixPosition(camera.matrixWorld);
+      this.controllerQuaternion.setFromRotationMatrix(camera.matrixWorld);
+      this.direction
+        .set(0, 0, 1)
+        .applyQuaternion(this.controllerQuaternion)
+        .normalize();
     } else if (this.controller != null) {
       //3d cursor mode
-      this.controller.object3D.getWorldPosition(this.origin);
-      this.controller.object3D.getWorldQuaternion(this.controllerQuaternion);
+      this.controller.object3D.updateMatrixWorld(true);
+      this.origin.setFromMatrixPosition(this.controller.object3D.matrixWorld);
+      this.controllerQuaternion.setFromRotationMatrix(this.controller.object3D.matrixWorld);
       this.direction
         .set(0, 0, -1)
         .applyQuaternion(this.controllerQuaternion)
-- 
GitLab