mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 00:24:46 +02:00
equip highlight works now
This commit is contained in:
parent
774cb33303
commit
b2d7eefc97
5 changed files with 34 additions and 6 deletions
|
@ -271,6 +271,8 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
}
|
||||
}
|
||||
|
||||
// print("QQQ running plugins: " + JSON.stringify(_this.runningPluginNames));
|
||||
|
||||
// give time to running plugins
|
||||
for (var runningPluginName in _this.runningPluginNames) {
|
||||
if (_this.runningPluginNames.hasOwnProperty(runningPluginName)) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
|
||||
COLORS_GRAB_SEARCHING_FULL_SQUEEZE,
|
||||
COLORS_GRAB_DISTANCE_HOLD,
|
||||
NEAR_GRAB_RADIUS,
|
||||
Entities,
|
||||
makeDispatcherModuleParameters,
|
||||
makeRunningValues,
|
||||
|
@ -66,6 +67,9 @@ COLORS_GRAB_SEARCHING_FULL_SQUEEZE = { red: 250, green: 10, blue: 10 };
|
|||
COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 };
|
||||
|
||||
|
||||
NEAR_GRAB_RADIUS = 0.1;
|
||||
|
||||
|
||||
|
||||
// priority -- a lower priority means the module will be asked sooner than one with a higher priority in a given update step
|
||||
// activitySlots -- indicates which "slots" must not yet be in use for this module to start
|
||||
|
|
|
@ -82,7 +82,7 @@ EquipHotspotBuddy.prototype.updateHotspot = function(hotspot, timestamp) {
|
|||
ignoreRayIntersection: true
|
||||
}));
|
||||
overlayInfoSet.type = "model";
|
||||
print("QQQ adding hopspot: " + hotspot.key);
|
||||
print("QQQ adding hotspot: " + hotspot.key);
|
||||
this.map[hotspot.key] = overlayInfoSet;
|
||||
} else {
|
||||
print("QQQ updating hopspot: " + hotspot.key);
|
||||
|
@ -520,7 +520,9 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
this.targetEntityID = null;
|
||||
};
|
||||
|
||||
this.isReady = function (controllerData, deltaTime) {
|
||||
this.checkNearbyHotspots = function (controllerData, deltaTime) {
|
||||
|
||||
var timestamp = Date.now();
|
||||
|
||||
this.rawTriggerValue = controllerData.triggerValues[this.hand];
|
||||
this.triggerClicked = controllerData.triggerClicks[this.hand];
|
||||
|
@ -548,7 +550,6 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
}
|
||||
|
||||
var nearEquipHotspots = this.chooseNearEquipHotspots(candidateEntityProps, controllerData);
|
||||
var timestamp = Date.now();
|
||||
equipHotspotBuddy.updateHotspots(nearEquipHotspots, timestamp);
|
||||
if (potentialEquipHotspot) {
|
||||
equipHotspotBuddy.highlightHotspot(potentialEquipHotspot);
|
||||
|
@ -556,11 +557,22 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
|
||||
equipHotspotBuddy.update(deltaTime, timestamp, controllerData);
|
||||
|
||||
return makeRunningValues(false, [], []);
|
||||
if (potentialEquipHotspot) {
|
||||
return makeRunningValues(true, [potentialEquipHotspot.entityID], []);
|
||||
} else {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.isReady = function (controllerData, deltaTime) {
|
||||
return this.checkNearbyHotspots(controllerData, deltaTime);
|
||||
};
|
||||
|
||||
this.run = function (controllerData, deltaTime) {
|
||||
|
||||
return this.checkNearbyHotspots(controllerData, deltaTime);
|
||||
|
||||
if (controllerData.secondaryValues[this.hand]) {
|
||||
// this.secondaryReleased() will always be true when not depressed
|
||||
// so we cannot simply rely on that for release - ensure that the
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
getControllerJointIndex, getGrabbableData, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
||||
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable,
|
||||
Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues,
|
||||
TRIGGER_OFF_VALUE
|
||||
TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS
|
||||
*/
|
||||
|
||||
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
||||
|
@ -146,6 +146,11 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var nearbyEntityProperties = controllerData.nearbyEntityProperties[this.hand];
|
||||
for (var i = 0; i < nearbyEntityProperties.length; i++) {
|
||||
var props = nearbyEntityProperties[i];
|
||||
var handPosition = controllerData.controllerLocations[this.hand].position;
|
||||
var distance = Vec3.distance(props.position, handPosition);
|
||||
if (distance > NEAR_GRAB_RADIUS) {
|
||||
break;
|
||||
}
|
||||
if (entityIsGrabbable(props)) {
|
||||
return props;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID,
|
||||
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
||||
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
|
||||
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues
|
||||
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS
|
||||
*/
|
||||
|
||||
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
||||
|
@ -129,6 +129,11 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
var nearbyEntityProperties = controllerData.nearbyEntityProperties[this.hand];
|
||||
for (var i = 0; i < nearbyEntityProperties.length; i++) {
|
||||
var props = nearbyEntityProperties[i];
|
||||
var handPosition = controllerData.controllerLocations[this.hand].position;
|
||||
var distance = Vec3.distance(props.position, handPosition);
|
||||
if (distance > NEAR_GRAB_RADIUS) {
|
||||
break;
|
||||
}
|
||||
if (entityIsGrabbable(props)) {
|
||||
return props;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue