mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
fixing nearGrabParentModule switching grabbed overlays
This commit is contained in:
parent
4a95023a2d
commit
949c343604
1 changed files with 10 additions and 6 deletions
|
@ -26,6 +26,7 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
this.previousParentID = {};
|
this.previousParentID = {};
|
||||||
this.previousParentJointIndex = {};
|
this.previousParentJointIndex = {};
|
||||||
this.previouslyUnhooked = {};
|
this.previouslyUnhooked = {};
|
||||||
|
this.robbed = false;
|
||||||
|
|
||||||
this.parameters = makeDispatcherModuleParameters(
|
this.parameters = makeDispatcherModuleParameters(
|
||||||
90,
|
90,
|
||||||
|
@ -111,9 +112,9 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
} else if (this.otherHandIsParent(grabbedProperties)) {
|
} else if (this.otherHandIsParent(grabbedProperties)) {
|
||||||
// the other hand is parent. Steal the object and information
|
// the other hand is parent. Steal the object and information
|
||||||
var otherModule = this.getOtherModule();
|
var otherModule = this.getOtherModule();
|
||||||
this.previousParentID[this.grabbedThingID] = otherModule.previousParentID[this.garbbedThingID];
|
this.previousParentID[this.grabbedThingID] = otherModule.previousParentID[this.grabbedThingID];
|
||||||
this.previousParentJointIndex[this.grabbedThingID] = otherModule.previousParentJointIndex[this.grabbedThingID];
|
this.previousParentJointIndex[this.grabbedThingID] = otherModule.previousParentJointIndex[this.grabbedThingID];
|
||||||
|
otherModule.robbed = true;
|
||||||
} else {
|
} else {
|
||||||
this.previousParentID[this.grabbedThingID] = grabbedProperties.parentID;
|
this.previousParentID[this.grabbedThingID] = grabbedProperties.parentID;
|
||||||
this.previousParentJointIndex[this.grabbedThingID] = grabbedProperties.parentJointIndex;
|
this.previousParentJointIndex[this.grabbedThingID] = grabbedProperties.parentJointIndex;
|
||||||
|
@ -134,12 +135,12 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
|
|
||||||
this.endNearParentingGrabOverlay = function () {
|
this.endNearParentingGrabOverlay = function () {
|
||||||
var previousParentID = this.previousParentID[this.grabbedThingID];
|
var previousParentID = this.previousParentID[this.grabbedThingID];
|
||||||
if (previousParentID === NULL_UUID || previousParentID === null || previousParentID === undefined) {
|
if ((previousParentID === NULL_UUID || previousParentID === null) && !this.robbed) {
|
||||||
Overlays.editOverlay(this.grabbedThingID, {
|
Overlays.editOverlay(this.grabbedThingID, {
|
||||||
parentID: NULL_UUID,
|
parentID: NULL_UUID,
|
||||||
parentJointIndex: -1
|
parentJointIndex: -1
|
||||||
});
|
});
|
||||||
} else {
|
} else if (!this.robbed){
|
||||||
// before we grabbed it, overlay was a child of something; put it back.
|
// before we grabbed it, overlay was a child of something; put it back.
|
||||||
Overlays.editOverlay(this.grabbedThingID, {
|
Overlays.editOverlay(this.grabbedThingID, {
|
||||||
parentID: this.previousParentID[this.grabbedThingID],
|
parentID: this.previousParentID[this.grabbedThingID],
|
||||||
|
@ -170,7 +171,9 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
|
|
||||||
|
|
||||||
this.isReady = function (controllerData) {
|
this.isReady = function (controllerData) {
|
||||||
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
|
if ((controllerData.triggerClicks[this.hand] === 0 &&
|
||||||
|
controllerData.secondaryValues[this.hand] === 0)) {
|
||||||
|
this.robbed = false;
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +185,7 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
});
|
});
|
||||||
|
|
||||||
var targetID = this.getTargetID(grabbableOverlays, controllerData);
|
var targetID = this.getTargetID(grabbableOverlays, controllerData);
|
||||||
if (targetID) {
|
if (targetID && !this.robbed) {
|
||||||
this.grabbedThingID = targetID;
|
this.grabbedThingID = targetID;
|
||||||
this.startNearParentingGrabOverlay(controllerData);
|
this.startNearParentingGrabOverlay(controllerData);
|
||||||
return makeRunningValues(true, [this.grabbedThingID], []);
|
return makeRunningValues(true, [this.grabbedThingID], []);
|
||||||
|
@ -194,6 +197,7 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
this.run = function (controllerData) {
|
this.run = function (controllerData) {
|
||||||
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
|
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
|
||||||
this.endNearParentingGrabOverlay();
|
this.endNearParentingGrabOverlay();
|
||||||
|
this.robbed = false;
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
} else {
|
} else {
|
||||||
// check if someone stole the target from us
|
// check if someone stole the target from us
|
||||||
|
|
Loading…
Reference in a new issue