mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:57:00 +02:00
Cleanup again
This commit is contained in:
parent
44624c5fab
commit
5f600b4ea9
1 changed files with 22 additions and 16 deletions
|
@ -22,28 +22,34 @@
|
||||||
var leftWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, leftHand.translation));
|
var leftWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, leftHand.translation));
|
||||||
var rightWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, rightHand.translation));
|
var rightWorldControllerPos = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, rightHand.translation));
|
||||||
var hipPosition = MyAvatar.getJointPosition("Hips");
|
var hipPosition = MyAvatar.getJointPosition("Hips");
|
||||||
var controllerHipThreshold = 0.1;
|
var controllerHipThreshold = 0.1; // In Meters. Experimentally determined. Used to figure out if user's hands are "close enough" to their hips.
|
||||||
var controllerRotationThreshold = 0.25;
|
var controllerRotationThreshold = 0.25; // In Radians. Experimentally determined. Used to figure out if user's hands are within a rotation threshold.
|
||||||
|
|
||||||
if ((leftWorldControllerPos.y > (hipPosition.y - controllerHipThreshold)) && (leftWorldControllerPos.y < (hipPosition.y + controllerHipThreshold)) && rightWorldControllerPos.y > (hipPosition.y - controllerHipThreshold) && (rightWorldControllerPos.y < (hipPosition.y + controllerHipThreshold))) {
|
if ((leftWorldControllerPos.y > (hipPosition.y - controllerHipThreshold)) &&
|
||||||
if (leftHand.rotation.y < controllerRotationThreshold && leftHand.rotation.y > -controllerRotationThreshold && rightHand.rotation.y < controllerRotationThreshold && rightHand.rotation.y > -controllerRotationThreshold) {
|
(leftWorldControllerPos.y < (hipPosition.y + controllerHipThreshold)) &&
|
||||||
isRocketing = true;
|
(rightWorldControllerPos.y > (hipPosition.y - controllerHipThreshold)) &&
|
||||||
MyAvatar.motorReferenceFrame = "world";
|
(rightWorldControllerPos.y < (hipPosition.y + controllerHipThreshold))) {
|
||||||
var moveVector = Vec3.multiply(Quat.getFront(Camera.getOrientation()), 10);
|
if ((leftHand.rotation.y < controllerRotationThreshold) &&
|
||||||
if (!MyAvatar.isFlying()) {
|
(leftHand.rotation.y > -controllerRotationThreshold) &&
|
||||||
moveVector = Vec3.sum(moveVector, {x: 0, y: 1, z: 0});
|
(rightHand.rotation.y < controllerRotationThreshold) &&
|
||||||
|
(rightHand.rotation.y > -controllerRotationThreshold)) {
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
MyAvatar.motorVelocity = moveVector;
|
|
||||||
MyAvatar.motorTimescale = 1.0;
|
|
||||||
} else {
|
} else {
|
||||||
checkCanStopRocketing();
|
checkCanStopRocketing();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
checkCanStopRocketing();
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
checkCanStopRocketing();
|
||||||
checkCanStopRocketing();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue