mirror of
https://github.com/overte-org/overte.git
synced 2025-04-29 21:42:42 +02:00
Revert handControllerGrab.js related changes
This commit is contained in:
parent
a4ecb69ea6
commit
299a8078e3
3 changed files with 29 additions and 34 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
/* global getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
|
/* global getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
|
||||||
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset,
|
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset,
|
||||||
setGrabCommunications, Menu, HMD, isInEditMode, isInVREditMode, AvatarList */
|
setGrabCommunications, Menu, HMD, isInEditMode, AvatarList */
|
||||||
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
@ -369,8 +369,8 @@ function projectOntoOverlayXYPlane(overlayID, worldPos) {
|
||||||
resolution.z = 1; // Circumvent divide-by-zero.
|
resolution.z = 1; // Circumvent divide-by-zero.
|
||||||
var scale = Overlays.getProperty(overlayID, "dimensions");
|
var scale = Overlays.getProperty(overlayID, "dimensions");
|
||||||
if (scale) {
|
if (scale) {
|
||||||
scale.z = 0.01; // overlay dimensions are 2D, not 3D.
|
scale.z = 0.01; // overlay dimensions are 2D, not 3D.
|
||||||
dimensions = Vec3.multiplyVbyV(Vec3.multiply(resolution, INCHES_TO_METERS / dpi), scale);
|
dimensions = Vec3.multiplyVbyV(Vec3.multiply(resolution, INCHES_TO_METERS / dpi), scale);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dimensions = Overlays.getProperty(overlayID, "dimensions");
|
dimensions = Overlays.getProperty(overlayID, "dimensions");
|
||||||
|
@ -380,8 +380,8 @@ function projectOntoOverlayXYPlane(overlayID, worldPos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position && rotation && dimensions) {
|
if (position && rotation && dimensions) {
|
||||||
return projectOntoXYPlane(worldPos, position, rotation, dimensions, DEFAULT_REGISTRATION_POINT);
|
return projectOntoXYPlane(worldPos, position, rotation, dimensions, DEFAULT_REGISTRATION_POINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handLaserIntersectItem(position, rotation, start) {
|
function handLaserIntersectItem(position, rotation, start) {
|
||||||
|
@ -539,7 +539,7 @@ function storeAttachPointForHotspotInSettings(hotspot, hand, offsetPosition, off
|
||||||
var EXTERNALLY_MANAGED_2D_MINOR_MODE = true;
|
var EXTERNALLY_MANAGED_2D_MINOR_MODE = true;
|
||||||
|
|
||||||
function isEditing() {
|
function isEditing() {
|
||||||
return EXTERNALLY_MANAGED_2D_MINOR_MODE && (isInEditMode() || isInVREditMode());
|
return EXTERNALLY_MANAGED_2D_MINOR_MODE && isInEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIn2DMode() {
|
function isIn2DMode() {
|
||||||
|
@ -1313,7 +1313,7 @@ function MyController(hand) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setState = function(newState, reason) {
|
this.setState = function(newState, reason) {
|
||||||
if (((isInEditMode() || isInVREditMode()) && this.grabbedThingID !== HMD.tabletID) &&
|
if ((isInEditMode() && this.grabbedThingID !== HMD.tabletID) &&
|
||||||
(newState !== STATE_OFF &&
|
(newState !== STATE_OFF &&
|
||||||
newState !== STATE_SEARCHING &&
|
newState !== STATE_SEARCHING &&
|
||||||
newState !== STATE_STYLUS_TOUCHING &&
|
newState !== STATE_STYLUS_TOUCHING &&
|
||||||
|
@ -1752,7 +1752,7 @@ function MyController(hand) {
|
||||||
var nonTabletEntities = grabbableEntities.filter(function(entityID) {
|
var nonTabletEntities = grabbableEntities.filter(function(entityID) {
|
||||||
return entityID != HMD.tabletID && entityID != HMD.homeButtonID;
|
return entityID != HMD.tabletID && entityID != HMD.homeButtonID;
|
||||||
});
|
});
|
||||||
if (nonTabletEntities.length > 0 && !isInEditMode() && !isInVREditMode()) {
|
if (nonTabletEntities.length > 0) {
|
||||||
Controller.triggerHapticPulse(1, 20, this.hand);
|
Controller.triggerHapticPulse(1, 20, this.hand);
|
||||||
}
|
}
|
||||||
this.grabPointIntersectsEntity = true;
|
this.grabPointIntersectsEntity = true;
|
||||||
|
@ -1765,9 +1765,9 @@ function MyController(hand) {
|
||||||
|
|
||||||
this.processStylus();
|
this.processStylus();
|
||||||
|
|
||||||
if (isInEditMode() && !isInVREditMode() && !this.isNearStylusTarget && HMD.isHandControllerAvailable()) {
|
if (isInEditMode() && !this.isNearStylusTarget && HMD.isHandControllerAvailable()) {
|
||||||
// Always showing lasers while in edit mode and hands/stylus is not active.
|
// Always showing lasers while in edit mode and hands/stylus is not active.
|
||||||
// But don't show lasers while in VR edit mode.
|
|
||||||
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
||||||
if (rayPickInfo.isValid) {
|
if (rayPickInfo.isValid) {
|
||||||
this.intersectionDistance = (rayPickInfo.entityID || rayPickInfo.overlayID) ? rayPickInfo.distance : 0;
|
this.intersectionDistance = (rayPickInfo.entityID || rayPickInfo.overlayID) ? rayPickInfo.distance : 0;
|
||||||
|
@ -1827,16 +1827,16 @@ function MyController(hand) {
|
||||||
var pickRay;
|
var pickRay;
|
||||||
var valid = true
|
var valid = true
|
||||||
|
|
||||||
var controllerLocation = getControllerWorldLocation(this.handToController(), true);
|
var controllerLocation = getControllerWorldLocation(this.handToController(), true);
|
||||||
var worldHandPosition = controllerLocation.position;
|
var worldHandPosition = controllerLocation.position;
|
||||||
var worldHandRotation = controllerLocation.orientation;
|
var worldHandRotation = controllerLocation.orientation;
|
||||||
valid = !(worldHandPosition === undefined);
|
valid = !(worldHandPosition === undefined);
|
||||||
|
|
||||||
pickRay = {
|
pickRay = {
|
||||||
origin: PICK_WITH_HAND_RAY ? worldHandPosition : MyAvatar.getHeadPosition(),
|
origin: PICK_WITH_HAND_RAY ? worldHandPosition : MyAvatar.getHeadPosition(),
|
||||||
direction: PICK_WITH_HAND_RAY ? Quat.getUp(worldHandRotation) : Quat.getFront(Camera.orientation),
|
direction: PICK_WITH_HAND_RAY ? Quat.getUp(worldHandRotation) : Quat.getFront(Camera.orientation),
|
||||||
length: PICK_MAX_DISTANCE
|
length: PICK_MAX_DISTANCE
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = {
|
var result = {
|
||||||
entityID: null,
|
entityID: null,
|
||||||
|
@ -2289,7 +2289,7 @@ function MyController(hand) {
|
||||||
return aDistance - bDistance;
|
return aDistance - bDistance;
|
||||||
});
|
});
|
||||||
entity = grabbableEntities[0];
|
entity = grabbableEntities[0];
|
||||||
if ((!isInEditMode() && !isInVREditMode()) || entity == HMD.tabletID) { // tablet is grabbable, even when editing
|
if (!isInEditMode() || entity == HMD.tabletID) { // tablet is grabbable, even when editing
|
||||||
name = entityPropertiesCache.getProps(entity).name;
|
name = entityPropertiesCache.getProps(entity).name;
|
||||||
this.grabbedThingID = entity;
|
this.grabbedThingID = entity;
|
||||||
this.grabbedIsOverlay = false;
|
this.grabbedIsOverlay = false;
|
||||||
|
@ -2389,7 +2389,7 @@ function MyController(hand) {
|
||||||
equipHotspotBuddy.highlightHotspot(potentialEquipHotspot);
|
equipHotspotBuddy.highlightHotspot(potentialEquipHotspot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (farGrabEnabled && farSearching && !isInVREditMode()) {
|
if (farGrabEnabled && farSearching) {
|
||||||
this.updateLaserPointer();
|
this.updateLaserPointer();
|
||||||
}
|
}
|
||||||
Reticle.setVisible(false);
|
Reticle.setVisible(false);
|
||||||
|
@ -3431,13 +3431,13 @@ function MyController(hand) {
|
||||||
var intersection = LaserPointers.getPrevRayPickResult(laserPointerID);
|
var intersection = LaserPointers.getPrevRayPickResult(laserPointerID);
|
||||||
if (intersection.type != RayPick.INTERSECTED_NONE) {
|
if (intersection.type != RayPick.INTERSECTED_NONE) {
|
||||||
if (intersection.objectID != this.grabbedThingID) {
|
if (intersection.objectID != this.grabbedThingID) {
|
||||||
this.callEntityMethodOnGrabbed("stopFarTrigger");
|
this.callEntityMethodOnGrabbed("stopFarTrigger");
|
||||||
this.grabbedThingID = null;
|
this.grabbedThingID = null;
|
||||||
this.setState(STATE_OFF, "laser moved off of entity");
|
this.setState(STATE_OFF, "laser moved off of entity");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.intersectionDistance = intersection.distance;
|
this.intersectionDistance = intersection.distance;
|
||||||
if (farGrabEnabled) {
|
if (farGrabEnabled) {
|
||||||
this.updateLaserPointer();
|
this.updateLaserPointer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
EDIT_SETTING = "io.highfidelity.isEditing"; // Note: This constant is duplicated in edit.js.
|
// note: this constant is currently duplicated in edit.js
|
||||||
isInEditMode = function () {
|
EDIT_SETTING = "io.highfidelity.isEditting";
|
||||||
|
isInEditMode = function isInEditMode() {
|
||||||
return Settings.getValue(EDIT_SETTING);
|
return Settings.getValue(EDIT_SETTING);
|
||||||
};
|
};
|
||||||
|
|
||||||
VR_EDIT_SETTING = "io.highfidelity.isVREditing"; // Note: This constant is duplicated in vr-edit.js.
|
|
||||||
isInVREditMode = function () {
|
|
||||||
return HMD.active && Settings.getValue(VR_EDIT_SETTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Function.prototype.bind) {
|
if (!Function.prototype.bind) {
|
||||||
Function.prototype.bind = function(oThis) {
|
Function.prototype.bind = function(oThis) {
|
||||||
if (typeof this !== 'function') {
|
if (typeof this !== 'function') {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
APP_ICON_DISABLED = "icons/tablet-icons/edit-disabled.svg",
|
APP_ICON_DISABLED = "icons/tablet-icons/edit-disabled.svg",
|
||||||
ENABLED_CAPTION_COLOR_OVERRIDE = "",
|
ENABLED_CAPTION_COLOR_OVERRIDE = "",
|
||||||
DISABLED_CAPTION_COLOR_OVERRIDE = "#888888",
|
DISABLED_CAPTION_COLOR_OVERRIDE = "#888888",
|
||||||
VR_EDIT_SETTING = "io.highfidelity.isVREditing", // Note: This constant is duplicated in utils.js.
|
|
||||||
START_DELAY = 2000, // ms
|
START_DELAY = 2000, // ms
|
||||||
|
|
||||||
// Application state
|
// Application state
|
||||||
|
@ -1392,7 +1391,7 @@
|
||||||
|
|
||||||
function updateHandControllerGrab() {
|
function updateHandControllerGrab() {
|
||||||
// Communicate app status to handControllerGrab.js.
|
// Communicate app status to handControllerGrab.js.
|
||||||
Settings.setValue(VR_EDIT_SETTING, isAppActive);
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUICommand(command, parameter) {
|
function onUICommand(command, parameter) {
|
||||||
|
|
Loading…
Reference in a new issue