Merge pull request #12375 from druiz17/lasers-64

RC64 - fix lasers going to origin
This commit is contained in:
John Conklin II 2018-02-09 11:11:07 -08:00 committed by GitHub
commit 5b63c0523d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

View file

@ -181,6 +181,8 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) {
if (properties["parentID"].isValid()) { if (properties["parentID"].isValid()) {
setParentID(QUuid(properties["parentID"].toString())); 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; needRenderItemUpdate = true;
} }
if (properties["parentJointIndex"].isValid()) { if (properties["parentJointIndex"].isValid()) {

View file

@ -63,7 +63,7 @@ glm::vec3 Line3DOverlay::getEnd() const {
localEnd = getLocalEnd(); localEnd = getLocalEnd();
worldEnd = localToWorld(localEnd, getParentID(), getParentJointIndex(), getScalesWithParent(), success); worldEnd = localToWorld(localEnd, getParentID(), getParentJointIndex(), getScalesWithParent(), success);
if (!success) { if (!success) {
qDebug() << "Line3DOverlay::getEnd failed"; qDebug() << "Line3DOverlay::getEnd failed, parentID = " << getParentID();
} }
return worldEnd; return worldEnd;
} }

View file

@ -707,7 +707,11 @@ public slots:
void setJointMappingsFromNetworkReply(); void setJointMappingsFromNetworkReply();
void setSessionUUID(const QUuid& sessionUUID) { void setSessionUUID(const QUuid& sessionUUID) {
if (sessionUUID != getID()) { if (sessionUUID != getID()) {
setID(sessionUUID); if (sessionUUID == QUuid()) {
setID(AVATAR_SELF_ID);
} else {
setID(sessionUUID);
}
emit sessionUUIDChanged(); emit sessionUUIDChanged();
} }
} }

View file

@ -208,7 +208,7 @@ Script.include("/~/system/libraries/Xform.js");
var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix()); var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix());
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition); 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 now = Date.now();
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
this.currentObjectTime = now; 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) { this.isReady = function (controllerData) {
if (HMD.active) { if (HMD.active) {
if (this.notPointingAtEntity(controllerData)) { if (this.notPointingAtEntity(controllerData)) {
@ -391,7 +399,7 @@ Script.include("/~/system/libraries/Xform.js");
this.run = function (controllerData) { this.run = function (controllerData) {
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE || if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
this.notPointingAtEntity(controllerData)) { this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
this.endNearGrabAction(); this.endNearGrabAction();
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }

View file

@ -30,7 +30,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
ignoreRayIntersection: true, // always ignore this ignoreRayIntersection: true, // always ignore this
drawInFront: !hudLayer, // Even when burried inside of something, show it. drawInFront: !hudLayer, // Even when burried inside of something, show it.
drawHUDLayer: hudLayer, drawHUDLayer: hudLayer,
parentID: MyAvatar.SELF_ID
}; };
this.halfEnd = { this.halfEnd = {
type: "sphere", type: "sphere",
@ -53,7 +52,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
ignoreRayIntersection: true, // always ignore this ignoreRayIntersection: true, // always ignore this
drawInFront: !hudLayer, // Even when burried inside of something, show it. drawInFront: !hudLayer, // Even when burried inside of something, show it.
drawHUDLayer: hudLayer, drawHUDLayer: hudLayer,
parentID: MyAvatar.SELF_ID
}; };
this.fullEnd = { this.fullEnd = {
type: "sphere", type: "sphere",
@ -76,7 +74,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
ignoreRayIntersection: true, // always ignore this ignoreRayIntersection: true, // always ignore this
drawInFront: !hudLayer, // Even when burried inside of something, show it. drawInFront: !hudLayer, // Even when burried inside of something, show it.
drawHUDLayer: hudLayer, drawHUDLayer: hudLayer,
parentID: MyAvatar.SELF_ID
}; };
this.renderStates = [ this.renderStates = [