From 34b517839373a212fdcca1b0096e0ba80af5f23a Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 26 Oct 2015 11:55:23 -0700 Subject: [PATCH] Fixing ping-ping entity script --- examples/toybox/ping_pong_gun/pingPongGun.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/toybox/ping_pong_gun/pingPongGun.js b/examples/toybox/ping_pong_gun/pingPongGun.js index 879d467293..48b82f0a36 100644 --- a/examples/toybox/ping_pong_gun/pingPongGun.js +++ b/examples/toybox/ping_pong_gun/pingPongGun.js @@ -45,6 +45,12 @@ green: 255, blue: 255 }; + + var TRIGGER_CONTROLS = [ + Controller.Standard.LT, + Controller.Standard.RT, + ]; + PingPongGun.prototype = { hand: null, @@ -53,11 +59,11 @@ canShoot: false, canShootTimeout: null, setRightHand: function() { - this.hand = 'RIGHT'; + this.hand = 1; }, setLeftHand: function() { - this.hand = 'LEFT'; + this.hand = 0; }, startNearGrab: function() { @@ -92,12 +98,7 @@ }, checkTriggerPressure: function(gunHand) { - var handClickString = gunHand + "_HAND_CLICK"; - - var handClick = Controller.findAction(handClickString); - - this.triggerValue = Controller.getActionValue(handClick); - + this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[gunHand]); if (this.triggerValue < RELOAD_THRESHOLD) { // print('RELOAD'); this.canShoot = true;