laser allways on prototype

This commit is contained in:
Dante Ruiz 2017-11-28 15:37:36 -08:00
parent 068b93fc30
commit 70820e6075
6 changed files with 32 additions and 16 deletions

View file

@ -14,7 +14,7 @@
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic,
getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays, isPointingAtUI
Picks, makeLaserLockInfo Xform
Picks, makeLaserLockInfo Xform, makeLaserParams
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -119,7 +119,7 @@ Script.include("/~/system/libraries/Xform.js");
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
[],
100,
this.hand);
makeLaserParams(this.hand, false));
this.handToController = function() {

View file

@ -9,7 +9,7 @@
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, MyAvatar, getGrabPointSphereOffset,
makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
DEFAULT_SEARCH_SPHERE_DISTANCE, getGrabbableData
DEFAULT_SEARCH_SPHERE_DISTANCE, getGrabbableData, makeLaserParams
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -34,7 +34,7 @@ Script.include("/~/system/libraries/controllers.js");
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
[],
100,
this.hand);
makeLaserParams(this.hand, false));
this.getTargetProps = function (controllerData) {
// nearbyEntityProperties is already sorted by length from controller

View file

@ -16,7 +16,8 @@
makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic,
getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays, isPointingAtUI
getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays, isPointingAtUI,
makeLaserParams
*/
(function() {
@ -36,7 +37,7 @@
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
[],
100,
(this.hand + HUD_LASER_OFFSET));
makeLaserParams((this.hand + HUD_LASER_OFFSET), false));
this.getOtherHandController = function() {
return (this.hand === RIGHT_HAND) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;

View file

@ -9,7 +9,7 @@
makeRunningValues, Messages, Quat, Vec3, makeDispatcherModuleParameters, Overlays, ZERO_VEC, HMD,
INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,
TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE, LaserPointers, RayPick, ContextOverlay, Picks
TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE, LaserPointers, RayPick, ContextOverlay, Picks, makeLaserParams
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -25,7 +25,7 @@ Script.include("/~/system/libraries/controllers.js");
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
[],
100,
this.hand);
makeLaserParams(hand, true));
this.grabModuleWantsNearbyOverlay = function(controllerData) {
if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE) {
@ -80,16 +80,14 @@ Script.include("/~/system/libraries/controllers.js");
var otherModuleRunning = this.getOtherModule().running;
if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) &&
!otherModuleRunning) {
if (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE) {
return makeRunningValues(true, [], []);
}
return makeRunningValues(true, [], []);
}
return makeRunningValues(false, [], []);
};
this.run = function (controllerData, deltaTime) {
var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData);
if (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE && !grabModuleNeedsToRun) {
if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) && !grabModuleNeedsToRun) {
this.running = true;
return makeRunningValues(true, [], []);
}

View file

@ -45,6 +45,7 @@
BUMPER_ON_VALUE:true,
getEntityParents:true,
findHandChildEntities:true,
makeLaserParams:true,
TEAR_AWAY_DISTANCE:true,
TEAR_AWAY_COUNT:true,
TEAR_AWAY_CHECK_TIME:true,
@ -134,6 +135,17 @@ makeLaserLockInfo = function(targetID, isOverlay, hand, offset) {
};
};
makeLaserParams = function(hand, allwaysOn) {
if (allwaysOn === undefined) {
allwaysOn = false;
}
return {
hand: hand,
allwaysOn: allwaysOn
};
};
makeRunningValues = function (active, targets, requiredDataForRun, laserLockInfo) {
return {
active: active,

View file

@ -95,6 +95,7 @@ Pointer = function(hudLayer, pickType, pointerData) {
this.pointerID = null;
this.visible = false;
this.locked = false;
this.allwaysOn = false;
this.hand = pointerData.hand;
delete pointerData.hand;
@ -150,7 +151,7 @@ Pointer = function(hudLayer, pickType, pointerData) {
mode = "hold";
} else if (triggerClicks[this.hand]) {
mode = "full";
} else if (triggerValues[this.hand] > TRIGGER_ON_VALUE) {
} else if (triggerValues[this.hand] > TRIGGER_ON_VALUE || this.allwaysOn) {
mode = "half";
}
}
@ -172,19 +173,23 @@ PointerManager = function() {
return pointer.pointerID;
};
this.makePointerVisible = function(index) {
this.makePointerVisible = function(laserParams) {
var index = laserParams.hand;
if (index < this.pointers.length && index >= 0) {
this.pointers[index].makeVisible();
this.pointers[index].allwaysOn = laserParams.allwaysOn;
}
};
this.makePointerInvisible = function(index) {
this.makePointerInvisible = function(laserParams) {
var index = laserParams.hand;
if (index < this.pointers.length && index >= 0) {
this.pointers[index].makeInvisible();
}
};
this.lockPointerEnd = function(index, lockData) {
this.lockPointerEnd = function(laserParams, lockData) {
var index = laserParams.hand;
if (index < this.pointers.length && index >= 0) {
this.pointers[index].lockEnd(lockData);
}