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,39 +12,45 @@
*/ */
(function() { (function() {
var isRocketing = false; var isRocketting = false;
MyAvatar.motorVelocity = 0; MyAvatar.motorVelocity = 0;
function checkRocketting() { function checkRocketting() {
if (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) { if (HMD.active) {
var leftHand = Controller.getPoseValue(Controller.Standard.LeftHand); if (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) {
var rightHand = Controller.getPoseValue(Controller.Standard.RightHand); var leftHand = Controller.getPoseValue(Controller.Standard.LeftHand);
var leftWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, leftHand.translation)); var rightHand = Controller.getPoseValue(Controller.Standard.RightHand);
var rightWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, rightHand.translation)); var leftWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, leftHand.translation));
var hipPosition = MyAvatar.getJointPosition("Hips"); var rightWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, rightHand.translation));
var hipPosition = MyAvatar.getJointPosition("Hips");
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) { 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))) {
isRocketing = true; if (leftHand.rotation.y < 0.25 && leftHand.rotation.y > -0.25 && rightHand.rotation.y < 0.25 && rightHand.rotation.y > -0.25) {
Controller.triggerHapticPulse(0.1, 120, 2); isRocketting = true;
MyAvatar.motorReferenceFrame = "world"; MyAvatar.motorReferenceFrame = "world";
var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10); var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10);
if(!MyAvatar.isFlying()) { if(!MyAvatar.isFlying()) {
moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0}); moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0});
}
MyAvatar.motorVelocity = moveVector;
MyAvatar.motorTimescale = 1.0;
} else {
if (isRocketting) {
MyAvatar.motorVelocity = 0;
isRocketting = false;
}
} }
MyAvatar.motorVelocity = moveVector;
MyAvatar.motorTimescale = 1.0;
} else { } else {
if (isRocketing) { if (isRocketting) {
MyAvatar.motorVelocity = 0; MyAvatar.motorVelocity = 0;
isRocketing = false; isRocketting = false;
} }
} }
} else { }
if (isRocketing) { } else {
MyAvatar.motorVelocity = 0; if(isRocketting) {
isRocketing = false; MyAvatar.motorVelocity = 0;
} isRocketting = false;
} }
} }
}; };