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