removing the last remaining laserPointers

This commit is contained in:
Dante Ruiz 2017-11-02 11:31:13 -07:00
parent 0580e23686
commit b6e3262164
2 changed files with 54 additions and 54 deletions

View file

@ -12,7 +12,7 @@
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3, enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3,
LaserPointers, RayPick, HMD, Uuid, AvatarList, Picks RayPick, HMD, Uuid, AvatarList, Picks, Pointers, PickType
*/ */
Script.include("/~/system/libraries/Xform.js"); Script.include("/~/system/libraries/Xform.js");
@ -149,7 +149,7 @@ Script.include("/~/system/libraries/controllers.js");
return otherModule; return otherModule;
}; };
this.teleportRayHandVisible = LaserPointers.createLaserPointer({ this.teleportRayHandVisible = Pointers.createPointer(PickType.Ray, {
joint: (_this.hand === RIGHT_HAND) ? "RightHand" : "LeftHand", joint: (_this.hand === RIGHT_HAND) ? "RightHand" : "LeftHand",
filter: Picks.PICK_ENTITIES, filter: Picks.PICK_ENTITIES,
faceAvatar: true, faceAvatar: true,
@ -157,14 +157,14 @@ Script.include("/~/system/libraries/controllers.js");
renderStates: teleportRenderStates, renderStates: teleportRenderStates,
defaultRenderStates: teleportDefaultRenderStates defaultRenderStates: teleportDefaultRenderStates
}); });
this.teleportRayHandInvisible = LaserPointers.createLaserPointer({ this.teleportRayHandInvisible = Pointers.createPointer(PickType.Ray, {
joint: (_this.hand === RIGHT_HAND) ? "RightHand" : "LeftHand", joint: (_this.hand === RIGHT_HAND) ? "RightHand" : "LeftHand",
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
faceAvatar: true, faceAvatar: true,
centerEndY: false, centerEndY: false,
renderStates: teleportRenderStates renderStates: teleportRenderStates
}); });
this.teleportRayHeadVisible = LaserPointers.createLaserPointer({ this.teleportRayHeadVisible = Pointers.createPointer(PickType.Ray, {
joint: "Avatar", joint: "Avatar",
filter: Picks.PICK_ENTITIES, filter: Picks.PICK_ENTITIES,
faceAvatar: true, faceAvatar: true,
@ -172,7 +172,7 @@ Script.include("/~/system/libraries/controllers.js");
renderStates: teleportRenderStates, renderStates: teleportRenderStates,
defaultRenderStates: teleportDefaultRenderStates defaultRenderStates: teleportDefaultRenderStates
}); });
this.teleportRayHeadInvisible = LaserPointers.createLaserPointer({ this.teleportRayHeadInvisible = Pointers.createPointer(PickType.Ray, {
joint: "Avatar", joint: "Avatar",
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
faceAvatar: true, faceAvatar: true,
@ -181,10 +181,10 @@ Script.include("/~/system/libraries/controllers.js");
}); });
this.cleanup = function() { this.cleanup = function() {
LaserPointers.removeLaserPointer(this.teleportRayHandVisible); Pointers.removePointer(this.teleportRayHandVisible);
LaserPointers.removeLaserPointer(this.teleportRayHandInvisible); Pointers.removePointer(this.teleportRayHandInvisible);
LaserPointers.removeLaserPointer(this.teleportRayHeadVisible); Pointers.removePointer(this.teleportRayHeadVisible);
LaserPointers.removeLaserPointer(this.teleportRayHeadInvisible); Pointers.removePointer(this.teleportRayHeadInvisible);
}; };
this.buttonPress = function(value) { this.buttonPress = function(value) {
@ -221,20 +221,20 @@ Script.include("/~/system/libraries/controllers.js");
{name: "teleport", path: teleportPath, end: teleportEnd}, {name: "teleport", path: teleportPath, end: teleportEnd},
{name: "seat", path: seatPath, end: seatEnd}]; {name: "seat", path: seatPath, end: seatEnd}];
LaserPointers.editRenderState(this.teleportRayHandVisible, "cancel", teleportRenderStates[0]); Pointers.editRenderState(this.teleportRayHandVisible, "cancel", teleportRenderStates[0]);
LaserPointers.editRenderState(this.teleportRayHandInvisible, "cancel", teleportRenderStates[0]); Pointers.editRenderState(this.teleportRayHandInvisible, "cancel", teleportRenderStates[0]);
LaserPointers.editRenderState(this.teleportRayHeadVisible, "cancel", teleportRenderStates[0]); Pointers.editRenderState(this.teleportRayHeadVisible, "cancel", teleportRenderStates[0]);
LaserPointers.editRenderState(this.teleportRayHeadInvisible, "cancel", teleportRenderStates[0]); Pointers.editRenderState(this.teleportRayHeadInvisible, "cancel", teleportRenderStates[0]);
LaserPointers.editRenderState(this.teleportRayHandVisible, "teleport", teleportRenderStates[1]); Pointers.editRenderState(this.teleportRayHandVisible, "teleport", teleportRenderStates[1]);
LaserPointers.editRenderState(this.teleportRayHandInvisible, "teleport", teleportRenderStates[1]); Pointers.editRenderState(this.teleportRayHandInvisible, "teleport", teleportRenderStates[1]);
LaserPointers.editRenderState(this.teleportRayHeadVisible, "teleport", teleportRenderStates[1]); Pointers.editRenderState(this.teleportRayHeadVisible, "teleport", teleportRenderStates[1]);
LaserPointers.editRenderState(this.teleportRayHeadInvisible, "teleport", teleportRenderStates[1]); Pointers.editRenderState(this.teleportRayHeadInvisible, "teleport", teleportRenderStates[1]);
LaserPointers.editRenderState(this.teleportRayHandVisible, "seat", teleportRenderStates[2]); Pointers.editRenderState(this.teleportRayHandVisible, "seat", teleportRenderStates[2]);
LaserPointers.editRenderState(this.teleportRayHandInvisible, "seat", teleportRenderStates[2]); Pointers.editRenderState(this.teleportRayHandInvisible, "seat", teleportRenderStates[2]);
LaserPointers.editRenderState(this.teleportRayHeadVisible, "seat", teleportRenderStates[2]); Pointers.editRenderState(this.teleportRayHeadVisible, "seat", teleportRenderStates[2]);
LaserPointers.editRenderState(this.teleportRayHeadInvisible, "seat", teleportRenderStates[2]); Pointers.editRenderState(this.teleportRayHeadInvisible, "seat", teleportRenderStates[2]);
} }
}; };
@ -254,15 +254,15 @@ Script.include("/~/system/libraries/controllers.js");
var pose = Controller.getPoseValue(handInfo[(_this.hand === RIGHT_HAND) ? 'right' : 'left'].controllerInput); var pose = Controller.getPoseValue(handInfo[(_this.hand === RIGHT_HAND) ? 'right' : 'left'].controllerInput);
var mode = pose.valid ? _this.hand : 'head'; var mode = pose.valid ? _this.hand : 'head';
if (!pose.valid) { if (!pose.valid) {
LaserPointers.disableLaserPointer(_this.teleportRayHandVisible); Pointers.disablePointer(_this.teleportRayHandVisible);
LaserPointers.disableLaserPointer(_this.teleportRayHandInvisible); Pointers.disablePointer(_this.teleportRayHandInvisible);
LaserPointers.enableLaserPointer(_this.teleportRayHeadVisible); Pointers.enablePointer(_this.teleportRayHeadVisible);
LaserPointers.enableLaserPointer(_this.teleportRayHeadInvisible); Pointers.enablePointer(_this.teleportRayHeadInvisible);
} else { } else {
LaserPointers.enableLaserPointer(_this.teleportRayHandVisible); Pointers.enablePointer(_this.teleportRayHandVisible);
LaserPointers.enableLaserPointer(_this.teleportRayHandInvisible); Pointers.enablePointer(_this.teleportRayHandInvisible);
LaserPointers.disableLaserPointer(_this.teleportRayHeadVisible); Pointers.disablePointer(_this.teleportRayHeadVisible);
LaserPointers.disableLaserPointer(_this.teleportRayHeadInvisible); Pointers.disablePointer(_this.teleportRayHeadInvisible);
} }
// We do up to 2 ray picks to find a teleport location. // We do up to 2 ray picks to find a teleport location.
@ -276,17 +276,17 @@ Script.include("/~/system/libraries/controllers.js");
// //
var result; var result;
if (mode === 'head') { if (mode === 'head') {
result = LaserPointers.getPrevRayPickResult(_this.teleportRayHeadInvisible); result = Pointers.getPrevPickResult(_this.teleportRayHeadInvisible);
} else { } else {
result = LaserPointers.getPrevRayPickResult(_this.teleportRayHandInvisible); result = Pointers.getPrevPickResult(_this.teleportRayHandInvisible);
} }
var teleportLocationType = getTeleportTargetType(result); var teleportLocationType = getTeleportTargetType(result);
if (teleportLocationType === TARGET.INVISIBLE) { if (teleportLocationType === TARGET.INVISIBLE) {
if (mode === 'head') { if (mode === 'head') {
result = LaserPointers.getPrevRayPickResult(_this.teleportRayHeadVisible); result = Pointers.getPrevPickResult(_this.teleportRayHeadVisible);
} else { } else {
result = LaserPointers.getPrevRayPickResult(_this.teleportRayHandVisible); result = Pointers.getPrevPickResult(_this.teleportRayHandVisible);
} }
teleportLocationType = getTeleportTargetType(result); teleportLocationType = getTeleportTargetType(result);
} }
@ -332,27 +332,27 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.disableLasers = function() { this.disableLasers = function() {
LaserPointers.disableLaserPointer(_this.teleportRayHandVisible); Pointers.disablePointer(_this.teleportRayHandVisible);
LaserPointers.disableLaserPointer(_this.teleportRayHandInvisible); Pointers.disablePointer(_this.teleportRayHandInvisible);
LaserPointers.disableLaserPointer(_this.teleportRayHeadVisible); Pointers.disablePointer(_this.teleportRayHeadVisible);
LaserPointers.disableLaserPointer(_this.teleportRayHeadInvisible); Pointers.disablePointer(_this.teleportRayHeadInvisible);
}; };
this.setTeleportState = function(mode, visibleState, invisibleState) { this.setTeleportState = function(mode, visibleState, invisibleState) {
if (mode === 'head') { if (mode === 'head') {
LaserPointers.setRenderState(_this.teleportRayHeadVisible, visibleState); Pointers.setRenderState(_this.teleportRayHeadVisible, visibleState);
LaserPointers.setRenderState(_this.teleportRayHeadInvisible, invisibleState); Pointers.setRenderState(_this.teleportRayHeadInvisible, invisibleState);
} else { } else {
LaserPointers.setRenderState(_this.teleportRayHandVisible, visibleState); Pointers.setRenderState(_this.teleportRayHandVisible, visibleState);
LaserPointers.setRenderState(_this.teleportRayHandInvisible, invisibleState); Pointers.setRenderState(_this.teleportRayHandInvisible, invisibleState);
} }
}; };
this.setIgnoreEntities = function(entitiesToIgnore) { this.setIgnoreEntities = function(entitiesToIgnore) {
LaserPointers.setIgnoreItems(this.teleportRayHandVisible, entitiesToIgnore); Pointers.setIgnoreItems(this.teleportRayHandVisible, entitiesToIgnore);
LaserPointers.setIgnoreItems(this.teleportRayHandInvisible, entitiesToIgnore); Pointers.setIgnoreItems(this.teleportRayHandInvisible, entitiesToIgnore);
LaserPointers.setIgnoreItems(this.teleportRayHeadVisible, entitiesToIgnore); Pointers.setIgnoreItems(this.teleportRayHeadVisible, entitiesToIgnore);
LaserPointers.setIgnoreItems(this.teleportRayHeadInvisible, entitiesToIgnore); Pointers.setIgnoreItems(this.teleportRayHeadInvisible, entitiesToIgnore);
}; };
} }

View file

@ -15,7 +15,7 @@
// //
/* global MyAvatar, Entities, Script, Camera, Vec3, Reticle, Overlays, getEntityCustomData, Messages, Quat, Controller, /* global MyAvatar, Entities, Script, Camera, Vec3, Reticle, Overlays, getEntityCustomData, Messages, Quat, Controller,
isInEditMode, HMD entityIsGrabbable*/ isInEditMode, HMD entityIsGrabbable, Pointers, PickType RayPick*/
(function() { // BEGIN LOCAL_SCOPE (function() { // BEGIN LOCAL_SCOPE
@ -265,7 +265,7 @@ function Grabber() {
}); });
RayPick.setIncludeItems(this.mouseRayOverlays, [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID]); RayPick.setIncludeItems(this.mouseRayOverlays, [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID]);
var renderStates = [{name: "grabbed", end: beacon}]; var renderStates = [{name: "grabbed", end: beacon}];
this.mouseRayEntities = LaserPointers.createLaserPointer({ this.mouseRayEntities = Pointers.createPointer(PickType.Ray, {
joint: "Mouse", joint: "Mouse",
filter: Picks.PICK_ENTITIES, filter: Picks.PICK_ENTITIES,
faceAvatar: true, faceAvatar: true,
@ -325,9 +325,9 @@ Grabber.prototype.pressEvent = function(event) {
return; return;
} }
var pickResults = LaserPointers.getPrevRayPickResult(this.mouseRayEntities); var pickResults = Pointers.getPrevPickResult(this.mouseRayEntities);
if (pickResults.type == Picks.INTERSECTED_NONE) { if (pickResults.type == Picks.INTERSECTED_NONE) {
LaserPointers.setRenderState(this.mouseRayEntities, ""); Pointers.setRenderState(this.mouseRayEntities, "");
return; return;
} }
@ -344,8 +344,8 @@ Grabber.prototype.pressEvent = function(event) {
return; return;
} }
LaserPointers.setRenderState(this.mouseRayEntities, "grabbed"); Pointers.setRenderState(this.mouseRayEntities, "grabbed");
LaserPointers.setLockEndUUID(this.mouseRayEntities, pickResults.objectID, false); Pointers.setLockEndUid(this.mouseRayEntities, pickResults.objectID, false);
mouse.startDrag(event); mouse.startDrag(event);
@ -358,7 +358,7 @@ Grabber.prototype.pressEvent = function(event) {
var objectBoundingDiameter = Vec3.length(entityProperties.dimensions); var objectBoundingDiameter = Vec3.length(entityProperties.dimensions);
beacon.dimensions.y = objectBoundingDiameter; beacon.dimensions.y = objectBoundingDiameter;
LaserPointers.editRenderState(this.mouseRayEntities, "grabbed", {end: beacon}); Pointers.editRenderState(this.mouseRayEntities, "grabbed", {end: beacon});
this.maxDistance = objectBoundingDiameter / MAX_SOLID_ANGLE; this.maxDistance = objectBoundingDiameter / MAX_SOLID_ANGLE;
if (Vec3.distance(this.startPosition, cameraPosition) > this.maxDistance) { if (Vec3.distance(this.startPosition, cameraPosition) > this.maxDistance) {
// don't allow grabs of things far away // don't allow grabs of things far away
@ -435,7 +435,7 @@ Grabber.prototype.releaseEvent = function(event) {
this.actionID = null; this.actionID = null;
LaserPointers.setRenderState(this.mouseRayEntities, ""); Pointers.setRenderState(this.mouseRayEntities, "");
var args = "mouse"; var args = "mouse";
Entities.callEntityMethod(this.entityID, "releaseGrab", args); Entities.callEntityMethod(this.entityID, "releaseGrab", args);
@ -590,7 +590,7 @@ Grabber.prototype.keyPressEvent = function(event) {
}; };
Grabber.prototype.cleanup = function() { Grabber.prototype.cleanup = function() {
LaserPointers.removeLaserPointer(this.mouseRayEntities); Pointers.removePointer(this.mouseRayEntities);
RayPick.removeRayPick(this.mouseRayOverlays); RayPick.removeRayPick(this.mouseRayOverlays);
}; };