Skip to content

Commit a3a203c

Browse files
Merge pull request #45 from Elettrotecnica/ammo-fix-force-push-example
Fix force-pushable example for the ammo driver
2 parents b2b2e02 + ac84a6a commit a3a203c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

examples/components/force-pushable.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ AFRAME.registerComponent('force-pushable', {
5959
const force = this.force
6060
const impulseBt = this.impulseBtVector
6161
const pusher = e.detail.cursorEl.object3D
62-
pusher.localToWorld(pusher.position)
63-
force.copy(el.object3D.position.sub(pusher.position))
62+
force.copy(pusher.position)
63+
pusher.localToWorld(force)
64+
force.copy(el.object3D.position.sub(force))
6465
force.normalize();
6566

66-
// not sure about units, but force seems much stronger with Ammo than Cannon, so scaling down
67-
// by a factor of 10.
68-
force.multiplyScalar(this.data.force / 10);
67+
force.multiplyScalar(this.data.force);
6968
impulseBt.setValue(force.x, force.y, force.z)
7069

7170
// use data from intersection to determine point at which to apply impulse.

0 commit comments

Comments
 (0)