direct haptics to right hand
This commit is contained in:
@@ -454,12 +454,14 @@ AFRAME.registerComponent('beat', {
|
||||
|
||||
if (!saberBoundingBox) { break; }
|
||||
|
||||
const hand = saberEls[i].getAttribute('saber-controls').hand;
|
||||
if (hitBoundingBox && saberBoundingBox.intersectsBox(hitBoundingBox)) {
|
||||
if (saberEls[i].components['saber-controls'].swinging &&
|
||||
this.data.color === saberColors[saberEls[i].getAttribute('saber-controls').hand]) {
|
||||
this.el.emit('beathit', null, true);
|
||||
this.el.emit(`beathit${hand}`, null, true);
|
||||
} else {
|
||||
this.wrongHit(saberEls[i].getAttribute('saber-controls').hand);
|
||||
this.wrongHit(hand);
|
||||
}
|
||||
this.el.parentNode.components['beat-hit-sound'].playSound(
|
||||
this.el, this.data.cutDirection);
|
||||
@@ -478,8 +480,9 @@ AFRAME.registerComponent('beat', {
|
||||
if (this.data.type === 'dot' && saberEls[i].components['saber-controls'].swinging &&
|
||||
this.data.color === saberColors[saberEls[i].getAttribute('saber-controls').hand]) {
|
||||
this.el.emit('beathit', null, true);
|
||||
this.el.emit(`beathit${hand}`, null, true);
|
||||
} else {
|
||||
this.wrongHit(saberEls[i].getAttribute('saber-controls').hand);
|
||||
this.wrongHit(hand);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
bind__saber-controls="bladeEnabled: isPlaying; isPaused: isPaused"
|
||||
bind__trail="enabled: isPlaying"
|
||||
haptics="events: mouseenter; dur: 35; force: 0.075"
|
||||
haptics__beat="eventsFrom: #beatContainer; events: beathit; dur: 80; force: 0.2"
|
||||
haptics__beat="eventsFrom: #beatContainer; events: beathit{{ hand }}; dur: 80; force: 0.2"
|
||||
haptics__draw="events: drawblade; dur: 750; force: 0.025"
|
||||
saber-controls="hand: {{ hand }}"
|
||||
thumb-controls
|
||||
|
||||
Reference in New Issue
Block a user