Skip to content

Commit c7b6ea5

Browse files
committed
remove emitting the hit event with el:null when there is no collision, the comment was also wrong there was no state to remove from current element
1 parent 97a2bb1 commit c7b6ea5

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

src/misc/grab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = AFRAME.registerComponent('grab', {
6565
// If the element is already grabbed (it could be grabbed by another controller).
6666
// If the hand is not grabbing the element does not stick.
6767
// If we're already grabbing something you can't grab again.
68-
if (!hitEl || hitEl.is(this.GRABBED_STATE) || !this.grabbing || this.hitEl) { return; }
68+
if (hitEl.is(this.GRABBED_STATE) || !this.grabbing || this.hitEl) { return; }
6969
hitEl.addState(this.GRABBED_STATE);
7070
this.hitEl = hitEl;
7171
this.constraint = new CANNON.LockConstraint(this.el.body, hitEl.body);

src/misc/sphere-collider.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ module.exports = AFRAME.registerComponent('sphere-collider', {
100100
.sort((a, b) => distanceMap.get(a) > distanceMap.get(b) ? 1 : -1)
101101
.forEach(this.handleHit);
102102

103-
// Remove collision state from current element.
104-
if (collisions.length === 0) {
105-
this.eventDetail.el = null;
106-
el.emit('hit', this.eventDetail);
107-
}
108-
109103
// Remove collision state from other elements.
110104
this.collisions
111105
.filter((el) => !distanceMap.has(el))

0 commit comments

Comments
 (0)