Showing the changes to scripts/system/controllers/controllerModules (6 of 70 files). Show all
Unified · Split
| @@ -6,11 +6,11 @@ · 5 unmodified lines | |||
| 6 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | 6 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, | 9 | /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, Camera, |
| 10 | getControllerJointIndex, enableDispatcherModule, disableDispatcherModule, | 10 | getControllerJointIndex, enableDispatcherModule, disableDispatcherModule, entityIsFarGrabbedByOther, |
| 11 | Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions, | 11 | Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions, |
| 12 | Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable, | 12 | Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable, |
| 13 | cloneEntity, DISPATCHER_PROPERTIES, TEAR_AWAY_DISTANCE, Uuid, unhighlightTargetEntity | 13 | cloneEntity, DISPATCHER_PROPERTIES, Uuid, unhighlightTargetEntity, isInEditMode |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | Script.include("/~/system/libraries/Xform.js"); | 16 | Script.include("/~/system/libraries/Xform.js"); |
| @@ -780,7 +780,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa · 763 unmodified lines | |||
| 780 | } | 780 | } |
| 781 | } | 781 | } |
| 782 | }; | 782 | }; |
| 783 | 783 | ||
| 784 | var clearGrabActions = function(entityID) { | 784 | var clearGrabActions = function(entityID) { |
| 785 | var actionIDs = Entities.getActionIDs(entityID); | 785 | var actionIDs = Entities.getActionIDs(entityID); |
| 786 | var myGrabTag = "grab-" + MyAvatar.sessionUUID; | 786 | var myGrabTag = "grab-" + MyAvatar.sessionUUID; |
| @@ -793,7 +793,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa · 6 unmodified lines | |||
| 793 | } | 793 | } |
| 794 | } | 794 | } |
| 795 | }; | 795 | }; |
| 796 | 796 | ||
| 797 | var onMousePress = function(event) { | 797 | var onMousePress = function(event) { |
| 798 | if (isInEditMode() || !event.isLeftButton) { // don't consider any left clicks on the entity while in edit | 798 | if (isInEditMode() || !event.isLeftButton) { // don't consider any left clicks on the entity while in edit |
| 799 | return; | 799 | return; |
| @@ -807,7 +807,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa · 7 unmodified lines | |||
| 807 | if (hasEquipData && entityProperties.parentID === EMPTY_PARENT_ID && !entityIsFarGrabbedByOther(entityID)) { | 807 | if (hasEquipData && entityProperties.parentID === EMPTY_PARENT_ID && !entityIsFarGrabbedByOther(entityID)) { |
| 808 | entityProperties.id = entityID; | 808 | entityProperties.id = entityID; |
| 809 | var rightHandPosition = MyAvatar.getJointPosition("RightHand"); | 809 | var rightHandPosition = MyAvatar.getJointPosition("RightHand"); |
| 810 | var leftHandPosition = MyAvatar.getJointPosition("LeftHand"); | 810 | var leftHandPosition = MyAvatar.getJointPosition("LeftHand"); |
| 811 | var distanceToRightHand = Vec3.distance(entityProperties.position, rightHandPosition); | 811 | var distanceToRightHand = Vec3.distance(entityProperties.position, rightHandPosition); |
| 812 | var distanceToLeftHand = Vec3.distance(entityProperties.position, leftHandPosition); | 812 | var distanceToLeftHand = Vec3.distance(entityProperties.position, leftHandPosition); |
| 813 | var leftHandAvailable = leftEquipEntity.targetEntityID === null; | 813 | var leftHandAvailable = leftEquipEntity.targetEntityID === null; |
| @@ -827,7 +827,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa · 13 unmodified lines | |||
| 827 | }; | 827 | }; |
| 828 | 828 | ||
| 829 | var onKeyPress = function(event) { | 829 | var onKeyPress = function(event) { |
| 830 | if (event.text === UNEQUIP_KEY) { | 830 | if (event.text.toLowerCase() === UNEQUIP_KEY) { |
| 831 | if (rightEquipEntity.targetEntityID) { | 831 | if (rightEquipEntity.targetEntityID) { |
| 832 | rightEquipEntity.endEquipEntity(); | 832 | rightEquipEntity.endEquipEntity(); |
| 833 | } | 833 | } |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable, | 10 | propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable, |
| 11 | Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues, | 11 | Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues, |
| 12 | TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity, | 12 | TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity, |
| 13 | HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, unhighlightTargetEntity | 13 | HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, unhighlightTargetEntity, Uuid |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); | 16 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); |
| @@ -7,12 +7,8 @@ · 6 unmodified lines | |||
| 7 | // Distributed under the Apache License, Version 2.0. | 7 | // Distributed under the Apache License, Version 2.0. |
| 8 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | 8 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 9 | 9 | ||
| 10 | /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, | 10 | /* global Script, MyAvatar, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, |
| 11 | getControllerJointIndex, getGrabbableData, enableDispatcherModule, disableDispatcherModule, | 11 | makeDispatcherModuleParameters, makeRunningValues, TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, BUMPER_ON_VALUE, AddressManager |
| 12 | propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable, | ||
| 13 | Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues, | ||
| 14 | TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity, | ||
| 15 | HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, AddressManager | ||
| 16 | */ | 12 | */ |
| 17 | 13 | ||
| 18 | (function() { | 14 | (function() { |
| @@ -11,8 +11,7 @@ · 10 unmodified lines | |||
| 11 | TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, | 11 | TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, |
| 12 | findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, | 12 | findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, |
| 13 | HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME, | 13 | HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME, |
| 14 | TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Selection, DISPATCHER_HOVERING_LIST, Uuid, | 14 | TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity |
| 15 | highlightTargetEntity, unhighlightTargetEntity | ||
| 16 | */ | 15 | */ |
| 17 | 16 | ||
| 18 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); | 17 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); |
| @@ -43,11 +42,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 24 unmodified lines | |||
| 43 | [], | 42 | [], |
| 44 | 100); | 43 | 100); |
| 45 | 44 | ||
| 46 | |||
| 47 | // XXX does handJointIndex change if the avatar changes? | ||
| 48 | this.handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"); | ||
| 49 | this.controllerJointIndex = getControllerJointIndex(this.hand); | ||
| 50 | |||
| 51 | this.thisHandIsParent = function(props) { | 45 | this.thisHandIsParent = function(props) { |
| 52 | if (!props) { | 46 | if (!props) { |
| 53 | return false; | 47 | return false; |
| @@ -62,8 +56,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 8 unmodified lines | |||
| 62 | return true; | 56 | return true; |
| 63 | } | 57 | } |
| 64 | 58 | ||
| 65 | var controllerJointIndex = this.controllerJointIndex; | 59 | if (props.parentJointIndex === getControllerJointIndex(this.hand)) { |
| 66 | if (props.parentJointIndex === controllerJointIndex) { | ||
| 67 | return true; | 60 | return true; |
| 68 | } | 61 | } |
| 69 | 62 | ||
| @@ -102,7 +95,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 32 unmodified lines | |||
| 102 | // } else { | 95 | // } else { |
| 103 | // handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"); | 96 | // handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"); |
| 104 | // } | 97 | // } |
| 105 | handJointIndex = this.controllerJointIndex; | 98 | handJointIndex = getControllerJointIndex(this.hand); |
| 106 | 99 | ||
| 107 | var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID]; | 100 | var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID]; |
| 108 | Entities.callEntityMethod(targetProps.id, "startNearGrab", args); | 101 | Entities.callEntityMethod(targetProps.id, "startNearGrab", args); |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | /* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, | 9 | /* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, |
| 10 | enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, | 10 | enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, |
| 11 | makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3, resizeTablet, getTabletWidthFromSettings, | 11 | makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3, resizeTablet, getTabletWidthFromSettings, |
| 12 | NEAR_GRAB_RADIUS | 12 | NEAR_GRAB_RADIUS, HMD, Uuid |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); | 15 | Script.include("/~/system/libraries/controllerDispatcherUtils.js"); |
| @@ -37,7 +37,6 @@ Script.include("/~/system/libraries/utils.js"); · 21 unmodified lines | |||
| 37 | 37 | ||
| 38 | // XXX does handJointIndex change if the avatar changes? | 38 | // XXX does handJointIndex change if the avatar changes? |
| 39 | this.handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"); | 39 | this.handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"); |
| 40 | this.controllerJointIndex = getControllerJointIndex(this.hand); | ||
| 41 | 40 | ||
| 42 | this.getOtherModule = function() { | 41 | this.getOtherModule = function() { |
| 43 | return (this.hand === RIGHT_HAND) ? leftNearParentingGrabOverlay : rightNearParentingGrabOverlay; | 42 | return (this.hand === RIGHT_HAND) ? leftNearParentingGrabOverlay : rightNearParentingGrabOverlay; |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | /* jslint bitwise: true */ | 11 | /* jslint bitwise: true */ |
| 12 | 12 | ||
| 13 | /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, | 13 | /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, |
| 14 | enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3, | 14 | enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3, |
| 15 | HMD, Uuid, AvatarList, Picks, Pointers, PickType | 15 | HMD, Uuid, AvatarList, Picks, Pointers, PickType |
| 16 | */ | 16 | */ |