repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 79f5a21954138c4d911c298d1f813cf5bed791f5:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 79f5a21954138c4d911c298d1f813cf5bed791f5
Author: James Baicoianu 
Date:   Wed Apr 11 14:25:28 2018 -0700

    Allocate vectors when needed

diff --git a/scripts/elements/raycaster.js b/scripts/elements/raycaster.js
index 0539e1872e3ed17c335963539b7645247bc9b8c8..
index ..7256bd82b6e2e9efcaee89a84dbaafe8ff8947e5 100644
--- a/scripts/elements/raycaster.js
+++ b/scripts/elements/raycaster.js
@@ -2,10 +2,12 @@ elation.require(['janusweb.janusbase'], function() {
   elation.component.add('janusweb.elements.raycaster', {
     create() {
       this.lasthitobject = null;
-      this.lasthitpos = V();
-      this.fwdvec = V();
     },
     update() {
+      if (!this.fwdvec) {
+        this.fwdvec = V();
+        this.lasthitpos = V();
+      }
       var hits = this.raycast(null, null, this.class);
       if (hits.length > 0) {
         var hit = hits[0],

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