From 1c5923914b4cf5bd99388e8a7a39fb459bd77a2d Mon Sep 17 00:00:00 2001 From: Cain Kilgore Date: Mon, 3 Jul 2017 19:58:26 +0100 Subject: [PATCH] Combining three if statements into one! --- .../marketplace/rocketHands/rockethands.js | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/unpublishedScripts/marketplace/rocketHands/rockethands.js b/unpublishedScripts/marketplace/rocketHands/rockethands.js index d5dfe48ea0..1025dcb0aa 100644 --- a/unpublishedScripts/marketplace/rocketHands/rockethands.js +++ b/unpublishedScripts/marketplace/rocketHands/rockethands.js @@ -15,23 +15,15 @@ var isRocketing = false; function checkRocketing() { - if (HMD.active) { - if (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) { - if (canRocket()) { - isRocketing = true; - MyAvatar.motorReferenceFrame = "world"; - var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10); - if (!MyAvatar.isFlying()) { - moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0}); - } - MyAvatar.motorVelocity = moveVector; - MyAvatar.motorTimescale = 1.0; - } else { - checkCanStopRocketing(); - } - } else { - checkCanStopRocketing(); + if (HMD.active && (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) && canRocket()) { + isRocketing = true; + MyAvatar.motorReferenceFrame = "world"; + var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10); + if (!MyAvatar.isFlying()) { + moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0}); } + MyAvatar.motorVelocity = moveVector; + MyAvatar.motorTimescale = 1.0; } else { checkCanStopRocketing(); }