mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 12:24:26 +02:00
Combining three if statements into one!
This commit is contained in:
parent
bfcddcf3b7
commit
1c5923914b
1 changed files with 8 additions and 16 deletions
|
@ -15,23 +15,15 @@
|
||||||
var isRocketing = false;
|
var isRocketing = false;
|
||||||
|
|
||||||
function checkRocketing() {
|
function checkRocketing() {
|
||||||
if (HMD.active) {
|
if (HMD.active && (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) && canRocket()) {
|
||||||
if (Controller.Hardware.Vive || Controller.Hardware.OculusTouch) {
|
isRocketing = true;
|
||||||
if (canRocket()) {
|
MyAvatar.motorReferenceFrame = "world";
|
||||||
isRocketing = true;
|
var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10);
|
||||||
MyAvatar.motorReferenceFrame = "world";
|
if (!MyAvatar.isFlying()) {
|
||||||
var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10);
|
moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0});
|
||||||
if (!MyAvatar.isFlying()) {
|
|
||||||
moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0});
|
|
||||||
}
|
|
||||||
MyAvatar.motorVelocity = moveVector;
|
|
||||||
MyAvatar.motorTimescale = 1.0;
|
|
||||||
} else {
|
|
||||||
checkCanStopRocketing();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
checkCanStopRocketing();
|
|
||||||
}
|
}
|
||||||
|
MyAvatar.motorVelocity = moveVector;
|
||||||
|
MyAvatar.motorTimescale = 1.0;
|
||||||
} else {
|
} else {
|
||||||
checkCanStopRocketing();
|
checkCanStopRocketing();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue