Skip to content

Commit 00e92b8

Browse files
authored
Merge pull request #488 from Jlu18/makePushable
Fixed makePushable not able to push the entity
2 parents ac6f035 + f72f3fd commit 00e92b8

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/components/structural/View.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class View extends Component {
139139
if (ent.tube) {
140140
return <a-tube path={ent.path} radius={ent.radius} material={ent.material} shadow={shadow} shadowcustomsetting></a-tube>;
141141
}
142-
return <a-entity key={ent.id} {...flattened} shadow={shadow} shadowcustomsetting ></a-entity>;
142+
return <a-entity class="raycastable" key={ent.id} {...flattened} shadow={shadow} shadowcustomsetting ></a-entity>;
143143
}
144144
}
145145
//return elements that contains necessary configuration for light indicator based on light's type and properties

src/utils/AFramePhysics.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ const THREE = AFRAME.THREE;
33

44
AFRAME.registerComponent("force-pushable", {
55
schema: {
6-
force: { default: 10 }
6+
force: {
7+
type: "number",
8+
default: 10
9+
}
710
},
811
init: function () {
912
this.pStart = new THREE.Vector3();
@@ -13,12 +16,11 @@ AFRAME.registerComponent("force-pushable", {
1316
forcePush: function () {
1417
let force,
1518
el = this.el,
16-
pStart = this.pStart.copy(this.sourceEl.getAttribute("position"));
17-
19+
pStart = this.pStart.copy(this.sourceEl.children[0].getAttribute("position"));
1820
// Compute direction of force, normalize, then scale.
1921
force = el.body.position.vsub(pStart);
2022
force.normalize();
21-
force.scale(this.data.force, force);
23+
force.scale(this.nextData.force, force);
2224

2325
el.body.applyImpulse(force, el.body.position);
2426
}

0 commit comments

Comments
 (0)