mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 23:02:32 +02:00
disable far-trigger and grab if using hand tracker
This commit is contained in:
parent
1c926db2db
commit
fa4d055ab1
5 changed files with 22 additions and 13 deletions
|
@ -14,7 +14,7 @@
|
|||
TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic,
|
||||
getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD,
|
||||
Picks, makeLaserLockInfo, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST,
|
||||
worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES, Uuid, Picks
|
||||
worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES, Uuid, Picks, handsAreTracked, Messages
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -374,6 +374,9 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.isReady = function (controllerData) {
|
||||
if (HMD.active) {
|
||||
if (handsAreTracked()) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
if (this.notPointingAtEntity(controllerData)) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC,
|
||||
projectOntoEntityXYPlane, ContextOverlay, HMD, Picks, makeLaserLockInfo, makeLaserParams, AddressManager,
|
||||
getEntityParents, Selection, DISPATCHER_HOVERING_LIST, unhighlightTargetEntity, Messages, findGrabbableGroupParent,
|
||||
worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES
|
||||
worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES, handsAreTracked
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -63,7 +63,6 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.endedGrab = 0;
|
||||
this.MIN_HAPTIC_PULSE_INTERVAL = 500; // ms
|
||||
this.disabled = false;
|
||||
var _this = this;
|
||||
this.initialControllerRotation = Quat.IDENTITY;
|
||||
this.currentControllerRotation = Quat.IDENTITY;
|
||||
this.manipulating = false;
|
||||
|
@ -99,7 +98,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.getOffhand = function () {
|
||||
return (this.hand === RIGHT_HAND ? LEFT_HAND : RIGHT_HAND);
|
||||
}
|
||||
};
|
||||
|
||||
// Activation criteria for rotating a fargrabbed entity. If we're changing the mapping, this is where to do it.
|
||||
this.shouldManipulateTarget = function (controllerData) {
|
||||
|
@ -406,6 +405,9 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.isReady = function (controllerData) {
|
||||
if (HMD.active) {
|
||||
if (handsAreTracked()) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
if (this.notPointingAtEntity(controllerData)) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* global Script, RIGHT_HAND, LEFT_HAND, MyAvatar,
|
||||
makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
|
||||
getGrabbableData, makeLaserParams, DISPATCHER_PROPERTIES
|
||||
getGrabbableData, makeLaserParams, DISPATCHER_PROPERTIES, RayPick, handsAreTracked
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -63,6 +63,9 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.isReady = function (controllerData) {
|
||||
this.targetEntityID = null;
|
||||
if (handsAreTracked()) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
if (controllerData.triggerClicks[this.hand] === 0) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@
|
|||
clearHighlightedEntities:true,
|
||||
unhighlightTargetEntity:true,
|
||||
distanceBetweenEntityLocalPositionAndBoundingBox: true,
|
||||
worldPositionToRegistrationFrameMatrix: true
|
||||
worldPositionToRegistrationFrameMatrix: true,
|
||||
handsAreTracked: true
|
||||
*/
|
||||
|
||||
MSECS_PER_SEC = 1000.0;
|
||||
|
@ -600,6 +601,10 @@ worldPositionToRegistrationFrameMatrix = function(wptrProps, pos) {
|
|||
return offsetMat;
|
||||
};
|
||||
|
||||
handsAreTracked = function () {
|
||||
return Controller.getPoseValue(Controller.Standard.LeftHandIndex3).valid ||
|
||||
Controller.getPoseValue(Controller.Standard.RightHandIndex3).valid;
|
||||
}
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = {
|
||||
|
@ -624,6 +629,7 @@ if (typeof module !== 'undefined') {
|
|||
TRIGGER_OFF_VALUE: TRIGGER_OFF_VALUE,
|
||||
TRIGGER_ON_VALUE: TRIGGER_ON_VALUE,
|
||||
DISPATCHER_HOVERING_LIST: DISPATCHER_HOVERING_LIST,
|
||||
worldPositionToRegistrationFrameMatrix: worldPositionToRegistrationFrameMatrix
|
||||
worldPositionToRegistrationFrameMatrix: worldPositionToRegistrationFrameMatrix,
|
||||
handsAreTracked: handsAreTracked
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/* global getTabletWidthFromSettings, TRIGGER_OFF_VALUE, Controller, Script, Camera, Tablet, MyAvatar,
|
||||
/* global getTabletWidthFromSettings, handsAreTracked, TRIGGER_OFF_VALUE, Controller, Script, Camera, Tablet, MyAvatar,
|
||||
Quat, SoundCache, HMD, Overlays, Vec3, Uuid, Messages */
|
||||
|
||||
(function () {
|
||||
|
@ -81,11 +81,6 @@
|
|||
return hand === LEFT_HAND ? RIGHT_HAND : LEFT_HAND;
|
||||
}
|
||||
|
||||
function handsAreTracked() {
|
||||
return Controller.getPoseValue(Controller.Standard.LeftHandIndex3).valid ||
|
||||
Controller.getPoseValue(Controller.Standard.RightHandIndex3).valid;
|
||||
}
|
||||
|
||||
UI = function () {
|
||||
|
||||
if (!(this instanceof UI)) {
|
||||
|
|
Loading…
Reference in a new issue