avoid calling editEntity on overlays

This commit is contained in:
Seth Alves 2017-05-04 18:52:17 -07:00
parent 0406cc41e0
commit 70efe4aa4f

View file

@ -3878,6 +3878,7 @@ function MyController(hand) {
// 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
// works around some problems that happen when more than one hand or avatar is passing something around.
var childType = Entities.getNestableType(childID);
if (_this.previousParentID[childID]) {
var previousParentID = _this.previousParentID[childID];
var previousParentJointIndex = _this.previousParentJointIndex[childID];
@ -3895,7 +3896,7 @@ function MyController(hand) {
}
_this.previouslyUnhooked[childID] = now;
if (Overlays.getProperty(childID, "grabbable")) {
if (childType == "overlay" && Overlays.getProperty(childID, "grabbable")) {
// only auto-unhook overlays that were flagged as grabbable. this avoids unhooking overlays
// used in tutorial.
Overlays.editOverlay(childID, {
@ -3903,7 +3904,12 @@ function MyController(hand) {
parentJointIndex: previousParentJointIndex
});
}
Entities.editEntity(childID, { parentID: previousParentID, parentJointIndex: previousParentJointIndex });
if (childType == "entity") {
Entities.editEntity(childID, {
parentID: previousParentID,
parentJointIndex: previousParentJointIndex
});
}
} else {
Entities.editEntity(childID, { parentID: NULL_UUID });