mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
Merge pull request #9812 from sethalves/dont-auto-ungrab-overlays
don't automatically unhook overlays from hands unless they were grabbable overlays
This commit is contained in:
commit
38668b6ce5
1 changed files with 11 additions and 4 deletions
|
@ -3552,7 +3552,6 @@ function MyController(hand) {
|
||||||
// we appear to be holding something and this script isn't in a state that would be holding something.
|
// we appear to be holding something and this script isn't in a state that would be holding something.
|
||||||
// unhook it. if we previously took note of this entity's parent, put it back where it was. This
|
// unhook it. if we previously took note of this entity's parent, put it back where it was. This
|
||||||
// works around some problems that happen when more than one hand or avatar is passing something around.
|
// works around some problems that happen when more than one hand or avatar is passing something around.
|
||||||
print("disconnecting stray child of hand: (" + _this.hand + ") " + childID);
|
|
||||||
if (_this.previousParentID[childID]) {
|
if (_this.previousParentID[childID]) {
|
||||||
var previousParentID = _this.previousParentID[childID];
|
var previousParentID = _this.previousParentID[childID];
|
||||||
var previousParentJointIndex = _this.previousParentJointIndex[childID];
|
var previousParentJointIndex = _this.previousParentJointIndex[childID];
|
||||||
|
@ -3570,13 +3569,21 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
_this.previouslyUnhooked[childID] = now;
|
_this.previouslyUnhooked[childID] = now;
|
||||||
|
|
||||||
// we don't know if it's an entity or an overlay
|
if (Overlays.getProperty(childID, "grabbable")) {
|
||||||
|
// only auto-unhook overlays that were flagged as grabbable. this avoids unhooking overlays
|
||||||
|
// used in tutorial.
|
||||||
|
Overlays.editOverlay(childID, {
|
||||||
|
parentID: previousParentID,
|
||||||
|
parentJointIndex: previousParentJointIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
Entities.editEntity(childID, { parentID: previousParentID, parentJointIndex: previousParentJointIndex });
|
Entities.editEntity(childID, { parentID: previousParentID, parentJointIndex: previousParentJointIndex });
|
||||||
Overlays.editOverlay(childID, { parentID: previousParentID, parentJointIndex: previousParentJointIndex });
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Entities.editEntity(childID, { parentID: NULL_UUID });
|
Entities.editEntity(childID, { parentID: NULL_UUID });
|
||||||
Overlays.editOverlay(childID, { parentID: NULL_UUID });
|
if (Overlays.getProperty(childID, "grabbable")) {
|
||||||
|
Overlays.editOverlay(childID, { parentID: NULL_UUID });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue