Fixed spelling, added is in HMD Check, removed Haptic Feedback as it wasn't part of the WL

This commit is contained in:
Cain Kilgore 2017-07-03 17:47:54 +01:00
parent 44f0b8bd60
commit 7d382d9da0

View file

@ -12,10 +12,11 @@
*/
(function() {
var isRocketing = false;
var isRocketting = false;
MyAvatar.motorVelocity = 0;
function checkRocketting() {
if (HMD.active) {
if (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) {
var leftHand = Controller.getPoseValue(Controller.Standard.LeftHand);
var rightHand = Controller.getPoseValue(Controller.Standard.RightHand);
@ -25,8 +26,7 @@
if ((leftWorldControllerPos.y > (hipPosition.y - 0.1)) && (leftWorldControllerPos.y < (hipPosition.y + 0.1)) && rightWorldControllerPos.y > (hipPosition.y - 0.1) && (rightWorldControllerPos.y < (hipPosition.y + 0.1))) {
if (leftHand.rotation.y < 0.25 && leftHand.rotation.y > -0.25 && rightHand.rotation.y < 0.25 && rightHand.rotation.y > -0.25) {
isRocketing = true;
Controller.triggerHapticPulse(0.1, 120, 2);
isRocketting = true;
MyAvatar.motorReferenceFrame = "world";
var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10);
if(!MyAvatar.isFlying()) {
@ -35,18 +35,24 @@
MyAvatar.motorVelocity = moveVector;
MyAvatar.motorTimescale = 1.0;
} else {
if (isRocketing) {
if (isRocketting) {
MyAvatar.motorVelocity = 0;
isRocketing = false;
isRocketting = false;
}
}
} else {
if (isRocketing) {
if (isRocketting) {
MyAvatar.motorVelocity = 0;
isRocketing = false;
isRocketting = false;
}
}
}
} else {
if(isRocketting) {
MyAvatar.motorVelocity = 0;
isRocketting = false;
}
}
};
Script.update.connect(checkRocketting);