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"; nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity";
nearGrabModule = getEnabledModuleByName(nearGrabName); nearGrabModule = getEnabledModuleByName(nearGrabName);
if (nearGrabModule && nearGrabModule.isReady(controllerData)) { if (nearGrabModule && nearGrabModule.isReady(controllerData)) {
return nearGrabModule.isReady(controllerData).active; // check for if near parent module is active.
} var isNearGrabModuleActive = nearGrabModule.isReady(controllerData).active;
nearGrabName = this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity"; if (isNearGrabModuleActive) {
nearGrabModule = getEnabledModuleByName(nearGrabName); // if true, return true.
if (nearGrabModule && nearGrabModule.isReady(controllerData)) { return isNearGrabModuleActive;
return nearGrabModule.isReady(controllerData).active; } 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; return false;