changing check for near grabbing modules - fixes grabbing for dynamic

This commit is contained in:
Wayne Chen 2018-09-12 10:38:21 -07:00
parent 045ac4cb0d
commit b9f0af63e1

View file

@ -49,12 +49,19 @@ Script.include("/~/system/libraries/controllers.js");
nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity";
nearGrabModule = getEnabledModuleByName(nearGrabName);
if (nearGrabModule && nearGrabModule.isReady(controllerData)) {
return nearGrabModule.isReady(controllerData).active;
}
nearGrabName = this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity";
nearGrabModule = getEnabledModuleByName(nearGrabName);
if (nearGrabModule && nearGrabModule.isReady(controllerData)) {
return nearGrabModule.isReady(controllerData).active;
// check for if near parent module is active.
var isNearGrabModuleActive = nearGrabModule.isReady(controllerData).active;
if (isNearGrabModuleActive) {
// if true, return true.
return isNearGrabModuleActive;
} else {
// check near action grab entity as a second pass.
nearGrabName = this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity";
nearGrabModule = getEnabledModuleByName(nearGrabName);
if (nearGrabModule && nearGrabModule.isReady(controllerData)) {
return nearGrabModule.isReady(controllerData).active;
}
}
}
}
return false;