History

Merge branch 'master' into M17428-f

David Rowe committed 8 years ago

Commit 7dba2e62 parents 8eeed77 bafdd06179 files · +4472 −1781Browse files

Showing the changes to scripts/system/controllers/controllerModules (3 of 179 files). Show all

Unified · Split

3 files
  1. scripts/system/controllers/controllerModules/farActionGrabEntity.js +5 −13
  2. scripts/system/controllers/controllerModules/farActionGrabEntityDynOnly.js +4 −13
  3. scripts/system/controllers/controllerModules/farParentGrabEntity.js +5 −13
scripts/system/controllers/controllerModules/farActionGrabEntity.js+5−13
@@ -14,7 +14,8 @@ · 13 unmodified lines
1414 PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
1515 DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic,
1616 getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays, isPointingAtUI
17− Picks, makeLaserLockInfo Xform, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST
17+ Picks, makeLaserLockInfo Xform, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST,
18+ worldPositionToRegistrationFrameMatrix
1819 */
1920
2021 Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@@ -593,18 +594,9 @@ Script.include("/~/system/libraries/Xform.js"); · 572 unmodified lines
593594
594595 this.calculateOffset = function(controllerData) {
595596 if (this.distanceHolding || this.distanceRotating) {
596− var targetProps = Entities.getEntityProperties(this.targetObject.entityID, [
597− "position",
598− "rotation"
599− ]);
600− var zeroVector = { x: 0, y: 0, z:0, w: 0 };
601− var intersection = controllerData.rayPicks[this.hand].intersection;
602− var intersectionMat = new Xform(zeroVector, intersection);
603− var modelMat = new Xform(targetProps.rotation, targetProps.position);
604− var modelMatInv = modelMat.inv();
605− var xformMat = Xform.mul(modelMatInv, intersectionMat);
606− var offsetMat = Mat4.createFromRotAndTrans(xformMat.rot, xformMat.pos);
607− return offsetMat;
597+ var targetProps = Entities.getEntityProperties(this.targetObject.entityID,
598+ [ "position", "rotation", "registrationPoint", "dimensions" ]);
599+ return worldPositionToRegistrationFrameMatrix(targetProps, controllerData.rayPicks[this.hand].intersection);
608600 }
609601 return undefined;
610602 };
scripts/system/controllers/controllerModules/farActionGrabEntityDynOnly.js+4−13
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
1313 TRIGGER_ON_VALUE, ZERO_VEC, getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD,
1414 Picks, makeLaserLockInfo, Xform, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST,
15− Uuid
15+ Uuid, worldPositionToRegistrationFrameMatrix
1616 */
1717
1818 Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@@ -572,18 +572,9 @@ Script.include("/~/system/libraries/Xform.js"); · 553 unmodified lines
572572
573573 this.calculateOffset = function(controllerData) {
574574 if (this.distanceHolding || this.distanceRotating) {
575− var targetProps = Entities.getEntityProperties(this.targetObject.entityID, [
576− "position",
577− "rotation"
578− ]);
579− var zeroVector = { x: 0, y: 0, z:0, w: 0 };
580− var intersection = controllerData.rayPicks[this.hand].intersection;
581− var intersectionMat = new Xform(zeroVector, intersection);
582− var modelMat = new Xform(targetProps.rotation, targetProps.position);
583− var modelMatInv = modelMat.inv();
584− var xformMat = Xform.mul(modelMatInv, intersectionMat);
585− var offsetMat = Mat4.createFromRotAndTrans(xformMat.rot, xformMat.pos);
586− return offsetMat;
575+ var targetProps = Entities.getEntityProperties(this.targetObject.entityID,
576+ [ "position", "rotation", "registrationPoint", "dimensions" ]);
577+ return worldPositionToRegistrationFrameMatrix(targetProps, controllerData.rayPicks[this.hand].intersection);
587578 }
588579 return undefined;
589580 };
scripts/system/controllers/controllerModules/farParentGrabEntity.js+5−13
@@ -11,7 +11,8 @@ · 10 unmodified lines
1111 Entities, enableDispatcherModule, disableDispatcherModule, entityIsGrabbable, makeDispatcherModuleParameters, MSECS_PER_SEC,
1212 HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, getControllerWorldLocation,
1313 projectOntoEntityXYPlane, ContextOverlay, HMD, Picks, makeLaserLockInfo, Xform, makeLaserParams, AddressManager,
14− getEntityParents, Selection, DISPATCHER_HOVERING_LIST, unhighlightTargetEntity, Messages, Uuid, findGroupParent
14+ getEntityParents, Selection, DISPATCHER_HOVERING_LIST, unhighlightTargetEntity, Messages, Uuid, findGroupParent,
15+ worldPositionToRegistrationFrameMatrix
1516 */
1617
1718 Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@@ -615,18 +616,9 @@ Script.include("/~/system/libraries/Xform.js"); · 597 unmodified lines
615616
616617 this.calculateOffset = function(controllerData) {
617618 if (this.distanceHolding || this.distanceRotating) {
618− var targetProps = Entities.getEntityProperties(this.targetObject.entityID, [
619− "position",
620− "rotation"
621− ]);
622− var zeroVector = { x: 0, y: 0, z:0, w: 0 };
623− var intersection = controllerData.rayPicks[this.hand].intersection;
624− var intersectionMat = new Xform(zeroVector, intersection);
625− var modelMat = new Xform(targetProps.rotation, targetProps.position);
626− var modelMatInv = modelMat.inv();
627− var xformMat = Xform.mul(modelMatInv, intersectionMat);
628− var offsetMat = Mat4.createFromRotAndTrans(xformMat.rot, xformMat.pos);
629− return offsetMat;
619+ var targetProps = Entities.getEntityProperties(this.targetObject.entityID,
620+ [ "position", "rotation", "registrationPoint", "dimensions" ]);
621+ return worldPositionToRegistrationFrameMatrix(targetProps, controllerData.rayPicks[this.hand].intersection);
630622 }
631623 return undefined;
632624 };