Showing the changes to scripts/system/controllers/controllerModules (3 of 179 files). Show all
Unified · Split
| @@ -14,7 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, |
| 15 | 15 | DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic, |
| 16 | 16 | 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 | |
| 18 | 19 | */ |
| 19 | 20 | |
| 20 | 21 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); |
| @@ -593,18 +594,9 @@ Script.include("/~/system/libraries/Xform.js"); · 572 unmodified lines | ||
| 593 | 594 | |
| 594 | 595 | this.calculateOffset = function(controllerData) { |
| 595 | 596 | 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); | |
| 608 | 600 | } |
| 609 | 601 | return undefined; |
| 610 | 602 | }; |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, |
| 13 | 13 | TRIGGER_ON_VALUE, ZERO_VEC, getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, |
| 14 | 14 | Picks, makeLaserLockInfo, Xform, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST, |
| 15 | − Uuid | |
| 15 | + Uuid, worldPositionToRegistrationFrameMatrix | |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); |
| @@ -572,18 +572,9 @@ Script.include("/~/system/libraries/Xform.js"); · 553 unmodified lines | ||
| 572 | 572 | |
| 573 | 573 | this.calculateOffset = function(controllerData) { |
| 574 | 574 | 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); | |
| 587 | 578 | } |
| 588 | 579 | return undefined; |
| 589 | 580 | }; |
| @@ -11,7 +11,8 @@ · 10 unmodified lines | ||
| 11 | 11 | Entities, enableDispatcherModule, disableDispatcherModule, entityIsGrabbable, makeDispatcherModuleParameters, MSECS_PER_SEC, |
| 12 | 12 | HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, getControllerWorldLocation, |
| 13 | 13 | 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 | |
| 15 | 16 | */ |
| 16 | 17 | |
| 17 | 18 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); |
| @@ -615,18 +616,9 @@ Script.include("/~/system/libraries/Xform.js"); · 597 unmodified lines | ||
| 615 | 616 | |
| 616 | 617 | this.calculateOffset = function(controllerData) { |
| 617 | 618 | 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); | |
| 630 | 622 | } |
| 631 | 623 | return undefined; |
| 632 | 624 | }; |