mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 09:23:17 +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) {
|
||||
// by convention, a distance grab sets the tag of its action to be grab-*owner-session-id*.
|
||||
var actionIDs = Entities.getActionIDs(entityID);
|
||||
for (var actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
||||
var actionID = actionIDs[actionIndex];
|
||||
var actionArguments = Entities.getActionArguments(entityID, actionID);
|
||||
var tag = actionArguments["tag"];
|
||||
if (tag == getTag()) {
|
||||
// we see a grab-*uuid* shaped tag, but it's our tag, so that's okay.
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -259,6 +262,7 @@ function MyController(hand, triggerAction) {
|
|||
} else {
|
||||
if (entityIsGrabbedByOther(intersection.entityID)) {
|
||||
// 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;
|
||||
}
|
||||
// the hand is far from the intersected object. go into distance-holding mode
|
||||
|
|
Loading…
Reference in a new issue