Showing the changes to scripts/system/controllers/controllerModules (1 of 2 files). Show all
Unified · Split
| @@ -87,28 +87,69 @@ Script.include("/~/system/libraries/controllers.js"); · 86 unmodified lines | ||
| 87 | 87 | return MyAvatar.getDominantHand() === "right" ? 1 : 0; |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | + this.hoverItem = null; | |
| 91 | + | |
| 92 | + this.isTabletID = function (uuid) { | |
| 93 | + return [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID, HMD.homeButtonHightlightID].indexOf(uuid) !== -1; | |
| 94 | + }; | |
| 95 | + | |
| 90 | 96 | this.isReady = function(controllerData) { |
| 91 | 97 | var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE |
| 92 | 98 | && controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE; |
| 93 | 99 | if (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) { |
| 94 | 100 | this.updateAllwaysOn(); |
| 95 | 101 | if (this.parameters.handLaser.allwaysOn || isTriggerPressed) { |
| 102 | + var pointingAt = controllerData.rayPicks[this.hand].objectID; | |
| 103 | + if (this.isTabletID(pointingAt)) { | |
| 104 | + pointingAt = HMD.tabletID; | |
| 105 | + } | |
| 106 | + | |
| 107 | + if (pointingAt !== this.getOtherModule().hoverItem) { | |
| 108 | + this.hoverItem = pointingAt; | |
| 109 | + this.getOtherModule().parameters.handLaser.nonHoverItem = pointingAt; | |
| 110 | + } else { | |
| 111 | + this.hoverItem = null; | |
| 112 | + this.getOtherModule().parameters.handLaser.nonHoverItem = null; | |
| 113 | + } | |
| 114 | + | |
| 96 | 115 | return makeRunningValues(true, [], []); |
| 97 | 116 | } |
| 98 | 117 | } |
| 118 | + | |
| 119 | + this.hoverItem = null; | |
| 120 | + this.getOtherModule().parameters.handLaser.nonHoverItem = null; | |
| 121 | + | |
| 99 | 122 | return makeRunningValues(false, [], []); |
| 100 | 123 | }; |
| 101 | 124 | |
| 102 | 125 | this.run = function(controllerData, deltaTime) { |
| 103 | 126 | var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData); |
| 104 | − if (!grabModuleNeedsToRun && (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE | |
| 105 | − || this.parameters.handLaser.allwaysOn | |
| 127 | + var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE; | |
| 128 | + if (!grabModuleNeedsToRun && (isTriggerPressed || this.parameters.handLaser.allwaysOn | |
| 106 | 129 | && (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)))) { |
| 107 | 130 | this.running = true; |
| 131 | + | |
| 132 | + var pointingAt = controllerData.rayPicks[this.hand].objectID; | |
| 133 | + if (this.isTabletID(pointingAt)) { | |
| 134 | + pointingAt = HMD.tabletID; | |
| 135 | + } | |
| 136 | + | |
| 137 | + if (pointingAt !== this.getOtherModule().hoverItem || isTriggerPressed) { | |
| 138 | + this.hoverItem = pointingAt; | |
| 139 | + this.getOtherModule().parameters.handLaser.nonHoverItem = pointingAt; | |
| 140 | + } else { | |
| 141 | + this.hoverItem = null; | |
| 142 | + this.getOtherModule().parameters.handLaser.nonHoverItem = null; | |
| 143 | + } | |
| 144 | + | |
| 108 | 145 | return makeRunningValues(true, [], []); |
| 109 | 146 | } |
| 110 | 147 | this.deleteContextOverlay(); |
| 111 | 148 | this.running = false; |
| 149 | + | |
| 150 | + this.hoverItem = null; | |
| 151 | + this.getOtherModule().parameters.handLaser.nonHoverItem = null; | |
| 152 | + | |
| 112 | 153 | return makeRunningValues(false, [], []); |
| 113 | 154 | }; |
| 114 | 155 | } |