From ce177ce900a80d71687729098ede486ff0a4f99d Mon Sep 17 00:00:00 2001
From: Kevin Lee <kevin@infinite-lee.com>
Date: Tue, 24 Apr 2018 20:13:51 -0700
Subject: [PATCH] need to use CANNON.Vec3's; also check ownership

---
 src/components/duck.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/components/duck.js b/src/components/duck.js
index 7045949bd..591729420 100644
--- a/src/components/duck.js
+++ b/src/components/duck.js
@@ -1,3 +1,4 @@
+/* global CANNON */
 AFRAME.registerComponent("duck", {
   schema: {
     initialForce: { default: 0 },
@@ -8,8 +9,8 @@ AFRAME.registerComponent("duck", {
   init: function() {
     this.physicsSystem = this.el.sceneEl.systems.physics;
     this.hasBody = false;
-    this.position = new THREE.Vector3();
-    this.force = new THREE.Vector3(0, this.data.initialForce, 0);
+    this.position = new CANNON.Vec3();
+    this.force = new CANNON.Vec3(0, this.data.initialForce, 0);
     this.initialScale = this.el.object3D.scale.x;
     this.maxScale = this.data.maxScale * this.initialScale;
   },
@@ -23,7 +24,7 @@ AFRAME.registerComponent("duck", {
   },
 
   beforeStep: function() {
-    if (this.el.body) {
+    if (this.el.body && NAF.utils.isMine(this.el)) {
       const currentScale = this.el.object3D.scale.x;
       const ratio = Math.min(1, (currentScale - this.initialScale) / (this.maxScale - this.initialScale));
       const force = ratio * this.data.maxForce;
-- 
GitLab