diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index d49579ce3f..aa61081da9 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -75,7 +75,7 @@ var WEB_TOUCH_Y_OFFSET = 0.05; // how far forward (or back with a negative numbe // // distant manipulation // -var accelarationStartingPoint = 0; +var linearTimeScale = 0; var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand and object var DISTANCE_HOLDING_ACTION_TIMEFRAME = 0.1; // how quickly objects move to their new position var DISTANCE_HOLDING_UNITY_MASS = 1200; // The mass at which the distance holding action timeframe is unmodified @@ -2525,14 +2525,8 @@ function MyController(hand) { // compute the mass for the purpose of energy and how quickly to move object this.mass = this.getMass(grabbedProperties.dimensions, grabbedProperties.density); var distanceToObject = Vec3.length(Vec3.subtract(MyAvatar.position, grabbedProperties.position)); - - - var MyAvatarHipsPosition = MyAvatar.getJointPosition("Hips"); - var distanceToHandFromAvatarHips = Vec3.length(Vec3.subtract(worldControllerPosition, MyAvatarHipsPosition)); - var ACCELERATION_START_THRESHOLD = 0.95; - this.accelarationStartingPoint = (distanceToHandFromAvatarHips * ACCELERATION_START_THRESHOLD); var timeScale = this.distanceGrabTimescale(this.mass, distanceToObject); - + this.linearTimeScale = timeScale; this.actionID = NULL_UUID; this.actionID = Entities.addAction("spring", this.grabbedThingID, { targetPosition: this.currentObjectPosition, @@ -2625,13 +2619,7 @@ function MyController(hand) { } // don't let grabRadius go all the way to zero, because it can't come back from that - var MINIMUM_GRAB_RADIUS = 0.3; - var MyAvatarHipsPosition = MyAvatar.getJointPosition("Hips"); - var distanceToHandFromAvatarHips = Vec3.length(Vec3.subtract(worldControllerPosition, MyAvatarHipsPosition)); - if(distanceToHandFromAvatarHips <= this.accelarationStartingPoint && this.grabRadius >= MINIMUM_GRAB_RADIUS){ - var RAPID_PACE_RATE = 2; - this.grabRadius = (this.grabRadius / RAPID_PACE_RATE); - } + var MINIMUM_GRAB_RADIUS = 0.1; if (this.grabRadius < MINIMUM_GRAB_RADIUS) { this.grabRadius = MINIMUM_GRAB_RADIUS; } @@ -2670,9 +2658,13 @@ function MyController(hand) { this.grabbedThingID); var distanceToObject = Vec3.length(Vec3.subtract(MyAvatar.position, this.currentObjectPosition)); + this.linearTimeScale = (this.linearTimeScale / 2); + if(this.linearTimeScale <= DISTANCE_HOLDING_ACTION_TIMEFRAME){ + this.linearTimeScale = DISTANCE_HOLDING_ACTION_TIMEFRAME; + } var success = Entities.updateAction(this.grabbedThingID, this.actionID, { targetPosition: newTargetPosition, - linearTimeScale: this.distanceGrabTimescale(this.mass, distanceToObject), + linearTimeScale: this.linearTimeScale, targetRotation: this.currentObjectRotation, angularTimeScale: this.distanceGrabTimescale(this.mass, distanceToObject), ttl: ACTION_TTL