Fix local entity grabbing on desktop

This commit is contained in:
Ada 2025-06-02 04:28:17 +10:00
parent b9ebb7bb9f
commit 9a391c69da
2 changed files with 5 additions and 18 deletions

View File

@ -387,6 +387,7 @@ function makeNameTag(uuid) {
.add("dimensions", scaledDimensions)
.add("parentID", parentID)
.add("localPosition", localPosition)
.add("grab", { grabbable: false })
.create(CLEAR_ENTITY_EDIT_PROPS);
Script.setTimeout(function () {

View File

@ -202,19 +202,13 @@ function Grabber() {
this.liftKey = false; // SHIFT
this.rotateKey = false; // CONTROL
this.mouseRayOverlays = Picks.createPick(PickType.Ray, {
joint: "Mouse",
filter: Picks.PICK_OVERLAYS | Picks.PICK_INCLUDE_NONCOLLIDABLE,
enabled: true
});
var tabletItems = getMainTabletIDs();
if (tabletItems.length > 0) {
Picks.setIncludeItems(this.mouseRayOverlays, tabletItems);
}
var renderStates = [{name: "grabbed", end: beacon}];
this.mouseRayEntities = Pointers.createRayPointer({
joint: "Mouse",
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
filter: Picks.PICK_DOMAIN_ENTITIES |
Picks.PICK_AVATAR_ENTITIES |
Picks.PICK_LOCAL_ENTITIES |
Picks.PICK_INCLUDE_NONCOLLIDABLE,
faceAvatar: true,
scaleWithParent: true,
enabled: true,
@ -224,10 +218,8 @@ function Grabber() {
Grabber.prototype.setPicksAndPointersEnabled = function(enabled) {
if (enabled) {
Picks.enablePick(this.mouseRayOverlays);
Pointers.enablePointer(this.mouseRayEntities);
} else {
Picks.disablePick(this.mouseRayOverlays);
Pointers.disablePointer(this.mouseRayEntities);
}
}
@ -283,11 +275,6 @@ Grabber.prototype.pressEvent = function(event) {
return;
}
var overlayResult = Picks.getPrevPickResult(this.mouseRayOverlays);
if (overlayResult.type != Picks.INTERSECTED_NONE) {
return;
}
var pickResults = Pointers.getPrevPickResult(this.mouseRayEntities);
if (pickResults.type == Picks.INTERSECTED_NONE) {
Pointers.setRenderState(this.mouseRayEntities, "");
@ -494,7 +481,6 @@ Grabber.prototype.keyPressEvent = function(event) {
Grabber.prototype.cleanup = function() {
Pointers.removePointer(this.mouseRayEntities);
Picks.removePick(this.mouseRayOverlays);
if (this.grabID) {
MyAvatar.releaseGrab(this.grabID);
this.grabID = null;