keep near-grab radius small but still allow large equip hotspots

This commit is contained in:
Seth Alves 2016-08-27 20:23:19 -07:00
parent 2a5d686a76
commit d69e712bef

View file

@ -1269,7 +1269,7 @@ function MyController(hand) {
} }
} }
if (grabbableProps.hasOwnProperty("grabbable") && refCount == 0) { if (grabbableProps.hasOwnProperty("grabbable") && refCount === 0) {
grabbable = grabbableProps.grabbable; grabbable = grabbableProps.grabbable;
} }
@ -1415,10 +1415,10 @@ function MyController(hand) {
entityPropertiesCache.addEntity(rayPickInfo.entityID); entityPropertiesCache.addEntity(rayPickInfo.entityID);
} }
var candidateEntities = Entities.findEntities(handPosition, MAX_EQUIP_HOTSPOT_RADIUS); var candidateHotSpotEntities = Entities.findEntities(handPosition, MAX_EQUIP_HOTSPOT_RADIUS);
entityPropertiesCache.addEntities(candidateEntities); entityPropertiesCache.addEntities(candidateHotSpotEntities);
var potentialEquipHotspot = this.chooseBestEquipHotspot(candidateEntities); var potentialEquipHotspot = this.chooseBestEquipHotspot(candidateHotSpotEntities);
if (potentialEquipHotspot) { if (potentialEquipHotspot) {
if (this.triggerSmoothedGrab()) { if (this.triggerSmoothedGrab()) {
this.grabbedHotspot = potentialEquipHotspot; this.grabbedHotspot = potentialEquipHotspot;
@ -1428,6 +1428,7 @@ function MyController(hand) {
} }
} }
var candidateEntities = Entities.findEntities(handPosition, NEAR_GRAB_RADIUS);
var grabbableEntities = candidateEntities.filter(function(entity) { var grabbableEntities = candidateEntities.filter(function(entity) {
return _this.entityIsNearGrabbable(entity, handPosition, NEAR_GRAB_MAX_DISTANCE); return _this.entityIsNearGrabbable(entity, handPosition, NEAR_GRAB_MAX_DISTANCE);
}); });