From d91d0a20271c0ffdc063e37ea20c59b9080c7815 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 26 Oct 2015 12:47:31 -0700 Subject: [PATCH] Fixing spray can script --- examples/toybox/spray_paint/sprayPaintCan.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/toybox/spray_paint/sprayPaintCan.js b/examples/toybox/spray_paint/sprayPaintCan.js index 4e6719af76..60fd12b975 100644 --- a/examples/toybox/spray_paint/sprayPaintCan.js +++ b/examples/toybox/spray_paint/sprayPaintCan.js @@ -33,12 +33,17 @@ var MIN_POINT_DISTANCE = 0.01; var STROKE_WIDTH = 0.02; + var TRIGGER_CONTROLS = [ + Controller.Standard.LT, + Controller.Standard.RT, + ]; + this.setRightHand = function () { - this.hand = 'RIGHT'; + this.hand = 1; } this.setLeftHand = function () { - this.hand = 'LEFT'; + this.hand = 0; } this.startNearGrab = function () { @@ -46,11 +51,7 @@ } this.toggleWithTriggerPressure = function () { - var handClickString = this.whichHand + "_HAND_CLICK"; - - var handClick = Controller.findAction(handClickString); - - this.triggerValue = Controller.getActionValue(handClick); + this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[this.whichHand]); if (this.triggerValue < DISABLE_SPRAY_THRESHOLD && this.spraying === true) { this.spraying = false; this.disableStream();