mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:36:38 +02:00
try to fix double-distance-grabbing lockout
This commit is contained in:
parent
bb5abeeabb
commit
5b970e6b1a
1 changed files with 4 additions and 0 deletions
|
@ -87,15 +87,18 @@ function getTag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function entityIsGrabbedByOther(entityID) {
|
function entityIsGrabbedByOther(entityID) {
|
||||||
|
// by convention, a distance grab sets the tag of its action to be grab-*owner-session-id*.
|
||||||
var actionIDs = Entities.getActionIDs(entityID);
|
var actionIDs = Entities.getActionIDs(entityID);
|
||||||
for (var actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
for (var actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
||||||
var actionID = actionIDs[actionIndex];
|
var actionID = actionIDs[actionIndex];
|
||||||
var actionArguments = Entities.getActionArguments(entityID, actionID);
|
var actionArguments = Entities.getActionArguments(entityID, actionID);
|
||||||
var tag = actionArguments["tag"];
|
var tag = actionArguments["tag"];
|
||||||
if (tag == getTag()) {
|
if (tag == getTag()) {
|
||||||
|
// we see a grab-*uuid* shaped tag, but it's our tag, so that's okay.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tag.slice(0, 5) == "grab-") {
|
if (tag.slice(0, 5) == "grab-") {
|
||||||
|
// we see a grab-*uuid* shaped tag and it's not ours, so someone else is grabbing it.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,6 +262,7 @@ function MyController(hand, triggerAction) {
|
||||||
} else {
|
} else {
|
||||||
if (entityIsGrabbedByOther(intersection.entityID)) {
|
if (entityIsGrabbedByOther(intersection.entityID)) {
|
||||||
// don't allow two people to distance grab the same object
|
// don't allow two people to distance grab the same object
|
||||||
|
this.lineOn(pickRay.origin, Vec3.multiply(pickRay.direction, LINE_LENGTH), NO_INTERSECT_COLOR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// the hand is far from the intersected object. go into distance-holding mode
|
// the hand is far from the intersected object. go into distance-holding mode
|
||||||
|
|
Loading…
Reference in a new issue