mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 02:55:25 +02:00
Merge pull request #12085 from zfox23/commerce_fixHandControllerInspection
Fix bugs related to inspecting entities with hand controllers
This commit is contained in:
commit
0c38a5598f
2 changed files with 37 additions and 18 deletions
|
@ -151,7 +151,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
glm::vec3 normal;
|
glm::vec3 normal;
|
||||||
boundingBox.findRayIntersection(cameraPosition, direction, distance, face, normal);
|
boundingBox.findRayIntersection(cameraPosition, direction, distance, face, normal);
|
||||||
float offsetAngle = -CONTEXT_OVERLAY_OFFSET_ANGLE;
|
float offsetAngle = -CONTEXT_OVERLAY_OFFSET_ANGLE;
|
||||||
if (DependencyManager::get<PointerManager>()->isLeftHand(event.getID())) {
|
if (event.getID() == 1) { // "1" is left hand
|
||||||
offsetAngle *= -1.0f;
|
offsetAngle *= -1.0f;
|
||||||
}
|
}
|
||||||
contextOverlayPosition = cameraPosition +
|
contextOverlayPosition = cameraPosition +
|
||||||
|
|
|
@ -98,6 +98,7 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
this.targetObject = null;
|
this.targetObject = null;
|
||||||
this.actionID = null; // action this script created...
|
this.actionID = null; // action this script created...
|
||||||
this.entityToLockOnto = null;
|
this.entityToLockOnto = null;
|
||||||
|
this.potentialEntityWithContextOverlay = false;
|
||||||
this.entityWithContextOverlay = false;
|
this.entityWithContextOverlay = false;
|
||||||
this.contextOverlayTimer = false;
|
this.contextOverlayTimer = false;
|
||||||
this.previousCollisionStatus = false;
|
this.previousCollisionStatus = false;
|
||||||
|
@ -364,6 +365,7 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
if (this.entityWithContextOverlay) {
|
if (this.entityWithContextOverlay) {
|
||||||
ContextOverlay.destroyContextOverlay(this.entityWithContextOverlay);
|
ContextOverlay.destroyContextOverlay(this.entityWithContextOverlay);
|
||||||
this.entityWithContextOverlay = false;
|
this.entityWithContextOverlay = false;
|
||||||
|
this.potentialEntityWithContextOverlay = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -444,9 +446,13 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
|
|
||||||
this.targetObject = new TargetObject(entityID, targetProps);
|
this.targetObject = new TargetObject(entityID, targetProps);
|
||||||
this.targetObject.parentProps = getEntityParents(targetProps);
|
this.targetObject.parentProps = getEntityParents(targetProps);
|
||||||
|
|
||||||
|
Script.clearTimeout(this.contextOverlayTimer);
|
||||||
|
this.contextOverlayTimer = false;
|
||||||
if (entityID !== this.entityWithContextOverlay) {
|
if (entityID !== this.entityWithContextOverlay) {
|
||||||
this.destroyContextOverlay();
|
this.destroyContextOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetEntity = this.targetObject.getTargetEntity();
|
var targetEntity = this.targetObject.getTargetEntity();
|
||||||
entityID = targetEntity.id;
|
entityID = targetEntity.id;
|
||||||
targetProps = targetEntity.props;
|
targetProps = targetEntity.props;
|
||||||
|
@ -470,26 +476,39 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
this.startFarGrabAction(controllerData, targetProps);
|
this.startFarGrabAction(controllerData, targetProps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!this.entityWithContextOverlay && !this.contextOverlayTimer) {
|
} else if (!this.entityWithContextOverlay) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
_this.contextOverlayTimer = Script.setTimeout(function () {
|
|
||||||
if (!_this.entityWithContextOverlay && _this.contextOverlayTimer) {
|
if (_this.potentialEntityWithContextOverlay !== rayPickInfo.objectID) {
|
||||||
var props = Entities.getEntityProperties(rayPickInfo.objectID);
|
if (_this.contextOverlayTimer) {
|
||||||
var pointerEvent = {
|
Script.clearTimeout(_this.contextOverlayTimer);
|
||||||
type: "Move",
|
|
||||||
id: this.hand + 1, // 0 is reserved for hardware mouse
|
|
||||||
pos2D: projectOntoEntityXYPlane(rayPickInfo.objectID, rayPickInfo.intersection, props),
|
|
||||||
pos3D: rayPickInfo.intersection,
|
|
||||||
normal: rayPickInfo.surfaceNormal,
|
|
||||||
direction: Vec3.subtract(ZERO_VEC, rayPickInfo.surfaceNormal),
|
|
||||||
button: "Secondary"
|
|
||||||
};
|
|
||||||
if (ContextOverlay.createOrDestroyContextOverlay(rayPickInfo.objectID, pointerEvent)) {
|
|
||||||
_this.entityWithContextOverlay = rayPickInfo.objectID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_this.contextOverlayTimer = false;
|
_this.contextOverlayTimer = false;
|
||||||
}, 500);
|
_this.potentialEntityWithContextOverlay = rayPickInfo.objectID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_this.contextOverlayTimer) {
|
||||||
|
_this.contextOverlayTimer = Script.setTimeout(function () {
|
||||||
|
if (!_this.entityWithContextOverlay &&
|
||||||
|
_this.contextOverlayTimer &&
|
||||||
|
_this.potentialEntityWithContextOverlay === rayPickInfo.objectID) {
|
||||||
|
var props = Entities.getEntityProperties(rayPickInfo.objectID);
|
||||||
|
var pointerEvent = {
|
||||||
|
type: "Move",
|
||||||
|
id: _this.hand + 1, // 0 is reserved for hardware mouse
|
||||||
|
pos2D: projectOntoEntityXYPlane(rayPickInfo.objectID, rayPickInfo.intersection, props),
|
||||||
|
pos3D: rayPickInfo.intersection,
|
||||||
|
normal: rayPickInfo.surfaceNormal,
|
||||||
|
direction: Vec3.subtract(ZERO_VEC, rayPickInfo.surfaceNormal),
|
||||||
|
button: "Secondary"
|
||||||
|
};
|
||||||
|
if (ContextOverlay.createOrDestroyContextOverlay(rayPickInfo.objectID, pointerEvent)) {
|
||||||
|
_this.entityWithContextOverlay = rayPickInfo.objectID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_this.contextOverlayTimer = false;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (this.distanceRotating) {
|
} else if (this.distanceRotating) {
|
||||||
this.distanceRotate(otherFarGrabModule);
|
this.distanceRotate(otherFarGrabModule);
|
||||||
|
|
Loading…
Reference in a new issue