From f72f3fde8873a207cdbe34c1ec9dac569f35edd4 Mon Sep 17 00:00:00 2001 From: jlu18 Date: Wed, 12 May 2021 14:49:45 -0400 Subject: [PATCH] Fixed makePushable --- src/components/structural/View.js | 2 +- src/utils/AFramePhysics.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/structural/View.js b/src/components/structural/View.js index f14ea02b..9f47bbbf 100644 --- a/src/components/structural/View.js +++ b/src/components/structural/View.js @@ -139,7 +139,7 @@ class View extends Component { if (ent.tube) { return ; } - return ; + return ; } } //return elements that contains necessary configuration for light indicator based on light's type and properties diff --git a/src/utils/AFramePhysics.js b/src/utils/AFramePhysics.js index 5172cb3a..d9bb8782 100644 --- a/src/utils/AFramePhysics.js +++ b/src/utils/AFramePhysics.js @@ -3,7 +3,10 @@ const THREE = AFRAME.THREE; AFRAME.registerComponent("force-pushable", { schema: { - force: { default: 10 } + force: { + type: "number", + default: 10 + } }, init: function () { this.pStart = new THREE.Vector3(); @@ -13,12 +16,11 @@ AFRAME.registerComponent("force-pushable", { forcePush: function () { let force, el = this.el, - pStart = this.pStart.copy(this.sourceEl.getAttribute("position")); - + pStart = this.pStart.copy(this.sourceEl.children[0].getAttribute("position")); // Compute direction of force, normalize, then scale. force = el.body.position.vsub(pStart); force.normalize(); - force.scale(this.data.force, force); + force.scale(this.nextData.force, force); el.body.applyImpulse(force, el.body.position); }