From a3db9ae726efe37e4da4e7909a702ca107c37801 Mon Sep 17 00:00:00 2001 From: Cain Kilgore Date: Fri, 30 Jun 2017 15:40:42 +0100 Subject: [PATCH] Begin Rocket Hands branch --- scripts/developer/rockethands.js | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/developer/rockethands.js diff --git a/scripts/developer/rockethands.js b/scripts/developer/rockethands.js new file mode 100644 index 0000000000..b68d6cc9c6 --- /dev/null +++ b/scripts/developer/rockethands.js @@ -0,0 +1,35 @@ +"use strict"; + +// +// rockethands.js +// system +// +// Created by Cain Kilgore on 30/06/2017 +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +(function() { + function logToConsole(message) { + console.log("[rockethands.js] " + message); + } + + logToConsole("Rockethands.js script is now active."); + + Script.setInterval(function() { + if(Controller.Hardware.Vive) { + var rightHand = Controller.getPoseValue(Controller.Hardware.Vive.RightHand).rotation.y; + + // logToConsole("Y VALUE: " + rightHand); + if(rightHand < -0.1 && rightHand > -0.4) { + logToConsole("Pointing down.. eye position: " + Camera.getOrientation().x + ", " + Camera.getOrientation().y + ", " + Camera.getOrientation().z + " - we have liftoff - I think!"); + MyAvatar.motorReferenceFrame = "world"; + // MyAvatar.motorVelocity = {x: Camera.getOrientation().x, y: Camera.getOrientation().y*3, z: Camera.getOrientation().z}; + MyAvatar.motorVelocity = Camera.getOrientation()*3; + MyAvatar.motorTimescale = 1.0; + } + } + }, 1000); +}());