mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-13 12:22:15 +02:00
Merge pull request #12348 from druiz17/fix-lasers-going-to-origin
Fix lasers going to origin when trying to far grab.
This commit is contained in:
commit
02e9bd4fbc
5 changed files with 18 additions and 7 deletions
|
@ -181,6 +181,8 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
|||
|
||||
if (properties["parentID"].isValid()) {
|
||||
setParentID(QUuid(properties["parentID"].toString()));
|
||||
bool success;
|
||||
getParentPointer(success); // call this to hook-up the parent's back-pointers to its child overlays
|
||||
needRenderItemUpdate = true;
|
||||
}
|
||||
if (properties["parentJointIndex"].isValid()) {
|
||||
|
|
|
@ -63,7 +63,7 @@ glm::vec3 Line3DOverlay::getEnd() const {
|
|||
localEnd = getLocalEnd();
|
||||
worldEnd = localToWorld(localEnd, getParentID(), getParentJointIndex(), getScalesWithParent(), success);
|
||||
if (!success) {
|
||||
qDebug() << "Line3DOverlay::getEnd failed";
|
||||
qDebug() << "Line3DOverlay::getEnd failed, parentID = " << getParentID();
|
||||
}
|
||||
return worldEnd;
|
||||
}
|
||||
|
|
|
@ -707,7 +707,11 @@ public slots:
|
|||
void setJointMappingsFromNetworkReply();
|
||||
void setSessionUUID(const QUuid& sessionUUID) {
|
||||
if (sessionUUID != getID()) {
|
||||
setID(sessionUUID);
|
||||
if (sessionUUID == QUuid()) {
|
||||
setID(AVATAR_SELF_ID);
|
||||
} else {
|
||||
setID(sessionUUID);
|
||||
}
|
||||
emit sessionUUIDChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ Script.include("/~/system/libraries/Xform.js");
|
|||
var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix());
|
||||
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition);
|
||||
|
||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, ["position"]);
|
||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, GRABBABLE_PROPERTIES);
|
||||
var now = Date.now();
|
||||
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
|
||||
this.currentObjectTime = now;
|
||||
|
@ -369,6 +369,14 @@ Script.include("/~/system/libraries/Xform.js");
|
|||
}
|
||||
};
|
||||
|
||||
this.targetIsNull = function() {
|
||||
var properties = Entities.getEntityProperties(this.grabbedThingID);
|
||||
if (Object.keys(properties).length === 0 && this.distanceHolding) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.isReady = function (controllerData) {
|
||||
if (HMD.active) {
|
||||
if (this.notPointingAtEntity(controllerData)) {
|
||||
|
@ -391,7 +399,7 @@ Script.include("/~/system/libraries/Xform.js");
|
|||
|
||||
this.run = function (controllerData) {
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
|
||||
this.notPointingAtEntity(controllerData)) {
|
||||
this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
|
||||
this.endNearGrabAction();
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
ignoreRayIntersection: true, // always ignore this
|
||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||
drawHUDLayer: hudLayer,
|
||||
parentID: MyAvatar.SELF_ID
|
||||
};
|
||||
this.halfEnd = {
|
||||
type: "sphere",
|
||||
|
@ -53,7 +52,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
ignoreRayIntersection: true, // always ignore this
|
||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||
drawHUDLayer: hudLayer,
|
||||
parentID: MyAvatar.SELF_ID
|
||||
};
|
||||
this.fullEnd = {
|
||||
type: "sphere",
|
||||
|
@ -76,7 +74,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
ignoreRayIntersection: true, // always ignore this
|
||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||
drawHUDLayer: hudLayer,
|
||||
parentID: MyAvatar.SELF_ID
|
||||
};
|
||||
|
||||
this.renderStates = [
|
||||
|
|
Loading…
Reference in a new issue