mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:17:42 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into editToolsImprovements
This commit is contained in:
commit
023916e7e5
2 changed files with 48 additions and 16 deletions
|
@ -14,6 +14,7 @@
|
||||||
var leapHands = (function () {
|
var leapHands = (function () {
|
||||||
|
|
||||||
var isOnHMD,
|
var isOnHMD,
|
||||||
|
LEAP_ON_HMD_MENU_ITEM = "Leap Motion on HMD",
|
||||||
LEAP_OFFSET = 0.019, // Thickness of Leap Motion plus HMD clip
|
LEAP_OFFSET = 0.019, // Thickness of Leap Motion plus HMD clip
|
||||||
HMD_OFFSET = 0.100, // Eyeballs to front surface of Oculus DK2 TODO: Confirm and make depend on device and eye relief
|
HMD_OFFSET = 0.100, // Eyeballs to front surface of Oculus DK2 TODO: Confirm and make depend on device and eye relief
|
||||||
hands,
|
hands,
|
||||||
|
@ -30,7 +31,11 @@ var leapHands = (function () {
|
||||||
CALIBRATED = 2,
|
CALIBRATED = 2,
|
||||||
CALIBRATION_TIME = 1000, // milliseconds
|
CALIBRATION_TIME = 1000, // milliseconds
|
||||||
PI = 3.141593,
|
PI = 3.141593,
|
||||||
isWindows;
|
isWindows,
|
||||||
|
avatarScale,
|
||||||
|
avatarFaceModelURL,
|
||||||
|
avatarSkeletonModelURL,
|
||||||
|
settingsTimer;
|
||||||
|
|
||||||
function printSkeletonJointNames() {
|
function printSkeletonJointNames() {
|
||||||
var jointNames,
|
var jointNames,
|
||||||
|
@ -164,6 +169,10 @@ var leapHands = (function () {
|
||||||
|
|
||||||
calibrationStatus = CALIBRATING;
|
calibrationStatus = CALIBRATING;
|
||||||
|
|
||||||
|
avatarScale = MyAvatar.scale;
|
||||||
|
avatarFaceModelURL = MyAvatar.faceModelURL;
|
||||||
|
avatarSkeletonModelURL = MyAvatar.skeletonModelURL;
|
||||||
|
|
||||||
// Set avatar arms vertical, forearms horizontal, as "zero" position for calibration
|
// Set avatar arms vertical, forearms horizontal, as "zero" position for calibration
|
||||||
MyAvatar.setJointData("LeftArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, -90.0));
|
MyAvatar.setJointData("LeftArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, -90.0));
|
||||||
MyAvatar.setJointData("LeftForeArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, 180.0));
|
MyAvatar.setJointData("LeftForeArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, 180.0));
|
||||||
|
@ -189,6 +198,37 @@ var leapHands = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setIsOnHMD() {
|
||||||
|
isOnHMD = Menu.isOptionChecked(LEAP_ON_HMD_MENU_ITEM);
|
||||||
|
if (isOnHMD) {
|
||||||
|
print("Leap Motion: Is on HMD");
|
||||||
|
|
||||||
|
// Offset of Leap Motion origin from physical eye position
|
||||||
|
hands[0].zeroPosition = { x: 0.0, y: 0.0, z: HMD_OFFSET + LEAP_OFFSET };
|
||||||
|
hands[1].zeroPosition = { x: 0.0, y: 0.0, z: HMD_OFFSET + LEAP_OFFSET };
|
||||||
|
|
||||||
|
calibrationStatus = CALIBRATED;
|
||||||
|
} else {
|
||||||
|
print("Leap Motion: Is on desk");
|
||||||
|
calibrationStatus = UNCALIBRATED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkSettings() {
|
||||||
|
// There is no "scale changed" event so we need check periodically.
|
||||||
|
if (!isOnHMD && calibrationStatus > UNCALIBRATED && (MyAvatar.scale !== avatarScale
|
||||||
|
|| MyAvatar.faceModelURL !== avatarFaceModelURL
|
||||||
|
|| MyAvatar.skeletonModelURL !== avatarSkeletonModelURL)) {
|
||||||
|
print("Leap Motion: Recalibrate because avatar body or scale changed");
|
||||||
|
calibrationStatus = UNCALIBRATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// There is a "menu changed" event but we may as well check here.
|
||||||
|
if (isOnHMD !== Menu.isOptionChecked(LEAP_ON_HMD_MENU_ITEM)) {
|
||||||
|
setIsOnHMD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
|
||||||
// TODO: Leap Motion controller joint naming doesn't match up with skeleton joint naming; numbers are out by 1.
|
// TODO: Leap Motion controller joint naming doesn't match up with skeleton joint naming; numbers are out by 1.
|
||||||
|
@ -267,19 +307,9 @@ var leapHands = (function () {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
isOnHMD = Menu.isOptionChecked("Leap Motion on HMD");
|
setIsOnHMD();
|
||||||
if (isOnHMD) {
|
|
||||||
print("Leap Motion is on HMD");
|
|
||||||
|
|
||||||
// Offset of Leap Motion origin from physical eye position
|
settingsTimer = Script.setInterval(checkSettings, 2000);
|
||||||
hands[0].zeroPosition = { x: 0.0, y: 0.0, z: HMD_OFFSET + LEAP_OFFSET };
|
|
||||||
hands[1].zeroPosition = { x: 0.0, y: 0.0, z: HMD_OFFSET + LEAP_OFFSET };
|
|
||||||
|
|
||||||
calibrationStatus = CALIBRATED;
|
|
||||||
} else {
|
|
||||||
print("Leap Motion is on desk");
|
|
||||||
calibrationStatus = UNCALIBRATED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveHands() {
|
function moveHands() {
|
||||||
|
@ -302,7 +332,7 @@ var leapHands = (function () {
|
||||||
|
|
||||||
if (hands[h].controller.isActive()) {
|
if (hands[h].controller.isActive()) {
|
||||||
|
|
||||||
// Calibrate when and if a controller is first active.
|
// Calibrate if necessary.
|
||||||
if (!checkCalibration()) {
|
if (!checkCalibration()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -430,6 +460,8 @@ var leapHands = (function () {
|
||||||
i,
|
i,
|
||||||
j;
|
j;
|
||||||
|
|
||||||
|
Script.clearInterval(settingsTimer);
|
||||||
|
|
||||||
for (h = 0; h < NUM_HANDS; h += 1) {
|
for (h = 0; h < NUM_HANDS; h += 1) {
|
||||||
Controller.releaseInputController(hands[h].controller);
|
Controller.releaseInputController(hands[h].controller);
|
||||||
Controller.releaseInputController(wrists[h].controller);
|
Controller.releaseInputController(wrists[h].controller);
|
||||||
|
|
|
@ -101,10 +101,10 @@ void SixenseManager::initialize() {
|
||||||
_sixenseLibrary = new QLibrary(SIXENSE_LIB_FILENAME);
|
_sixenseLibrary = new QLibrary(SIXENSE_LIB_FILENAME);
|
||||||
#else
|
#else
|
||||||
const QString SIXENSE_LIBRARY_NAME = "libsixense_x64";
|
const QString SIXENSE_LIBRARY_NAME = "libsixense_x64";
|
||||||
QFileInfo frameworkSixenseLibrary = QCoreApplication::applicationDirPath() + "../Frameworks/"
|
QString frameworkSixenseLibrary = QCoreApplication::applicationDirPath() + "../Frameworks/"
|
||||||
+ SIXENSE_LIBRARY_NAME;
|
+ SIXENSE_LIBRARY_NAME;
|
||||||
|
|
||||||
_sixenseLibrary = new QLibrary(frameworkSixenseLibrary.fileName());
|
_sixenseLibrary = new QLibrary(frameworkSixenseLibrary);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue