Fix using invalid pick API functions on HMD ray pointer

This commit is contained in:
sabrina-shanman 2019-07-22 11:25:49 -07:00
parent 79d09f68fd
commit abac1787a6
2 changed files with 7 additions and 7 deletions

View file

@ -291,13 +291,13 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Pointers.enablePointer(_this.rightPointer); Pointers.enablePointer(_this.rightPointer);
Pointers.enablePointer(_this.leftHudPointer); Pointers.enablePointer(_this.leftHudPointer);
Pointers.enablePointer(_this.rightHudPointer); Pointers.enablePointer(_this.rightHudPointer);
Picks.enablePick(_this.mouseRayPick); Pointers.enablePointer(_this.mouseRayPointer);
} else { } else {
Pointers.disablePointer(_this.leftPointer); Pointers.disablePointer(_this.leftPointer);
Pointers.disablePointer(_this.rightPointer); Pointers.disablePointer(_this.rightPointer);
Pointers.disablePointer(_this.leftHudPointer); Pointers.disablePointer(_this.leftHudPointer);
Pointers.disablePointer(_this.rightHudPointer); Pointers.disablePointer(_this.rightHudPointer);
Picks.disablePick(_this.mouseRayPick); Pointers.disablePointer(_this.mouseRayPointer);
} }
// raypick for each controller // raypick for each controller
@ -309,7 +309,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Pointers.getPrevPickResult(_this.leftHudPointer), Pointers.getPrevPickResult(_this.leftHudPointer),
Pointers.getPrevPickResult(_this.rightHudPointer) Pointers.getPrevPickResult(_this.rightHudPointer)
]; ];
var mouseRayPick = Pointers.getPrevPickResult(_this.mouseRayPick); var mouseRayPointer = Pointers.getPrevPickResult(_this.mouseRayPointer);
// if the pickray hit something very nearby, put it into the nearby entities list // if the pickray hit something very nearby, put it into the nearby entities list
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) { for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
@ -380,7 +380,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
nearbyOverlayIDs: nearbyOverlayIDs, nearbyOverlayIDs: nearbyOverlayIDs,
rayPicks: rayPicks, rayPicks: rayPicks,
hudRayPicks: hudRayPicks, hudRayPicks: hudRayPicks,
mouseRayPick: mouseRayPick mouseRayPointer: mouseRayPointer
}; };
if (PROFILE) { if (PROFILE) {
Script.endProfileRange("dispatch.gather"); Script.endProfileRange("dispatch.gather");
@ -545,7 +545,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
hand: RIGHT_HAND hand: RIGHT_HAND
}); });
this.mouseRayPick = Pointers.createPointer(PickType.Ray, { this.mouseRayPointer = Pointers.createPointer(PickType.Ray, {
joint: "Mouse", joint: "Mouse",
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE, filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
enabled: true enabled: true
@ -594,7 +594,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
this.cleanup = function () { this.cleanup = function () {
Controller.disableMapping(MAPPING_NAME); Controller.disableMapping(MAPPING_NAME);
_this.pointerManager.removePointers(); _this.pointerManager.removePointers();
Pointers.removePointer(this.mouseRayPick); Pointers.removePointer(this.mouseRayPointer);
}; };
} }

View file

@ -64,7 +64,7 @@
Reticle.depth = Vec3.distance(reticlePositionOnHUD, HMD.position); Reticle.depth = Vec3.distance(reticlePositionOnHUD, HMD.position);
} else { } else {
var APPARENT_MAXIMUM_DEPTH = 100.0; var APPARENT_MAXIMUM_DEPTH = 100.0;
var result = controllerData.mouseRayPick; var result = controllerData.mouseRayPointer;
Reticle.depth = result.intersects ? result.distance : APPARENT_MAXIMUM_DEPTH; Reticle.depth = result.intersects ? result.distance : APPARENT_MAXIMUM_DEPTH;
} }
}; };