Fix for exception in handControllerGrab.js

Specifically this:
    [UncaughtException] TypeError: Result of expression 'this.handToController' [undefined] is not a function. in file:///C:/msys64/home/anthony/code/hifi/build/interface/Release/scripts/defaultScripts.js:1388
This commit is contained in:
Anthony J. Thibault 2016-10-07 14:48:55 -07:00
parent a170436c8c
commit 0c2ebc27cb

View file

@ -1382,10 +1382,11 @@ function MyController(hand) {
this.chooseBestEquipHotspot = function(candidateEntities) {
var DISTANCE = 0;
var equippableHotspots = this.chooseNearEquipHotspots(candidateEntities, DISTANCE);
var _this = this;
if (equippableHotspots.length > 0) {
// sort by distance
equippableHotspots.sort(function(a, b) {
var handControllerLocation = getControllerWorldLocation(this.handToController(), true);
var handControllerLocation = getControllerWorldLocation(_this.handToController(), true);
var aDistance = Vec3.distance(a.worldPosition, handControllerLocation.position);
var bDistance = Vec3.distance(b.worldPosition, handControllerLocation.position);
return aDistance - bDistance;