Resolving conflicts of #21206

This commit is contained in:
volansystech 2017-04-20 23:54:41 +05:30
parent abc87c0338
commit 9e2899678a

View file

@ -75,7 +75,7 @@ var WEB_TOUCH_Y_OFFSET = 0.05; // how far forward (or back with a negative numbe
// //
// distant manipulation // distant manipulation
// //
var linearTimeScale = 0;
var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand and object 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_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 var DISTANCE_HOLDING_UNITY_MASS = 1200; // The mass at which the distance holding action timeframe is unmodified
@ -2150,7 +2150,7 @@ function MyController(hand) {
} }
}; };
this.searchEnter = function() { this.searchEnter = function() {
mostRecentSearchingHand = this.hand; mostRecentSearchingHand = this.hand;
var rayPickInfo = this.calcRayPickInfo(this.hand); var rayPickInfo = this.calcRayPickInfo(this.hand);
if (rayPickInfo.entityID || rayPickInfo.overlayID) { if (rayPickInfo.entityID || rayPickInfo.overlayID) {
@ -2565,7 +2565,7 @@ function MyController(hand) {
this.mass = this.getMass(grabbedProperties.dimensions, grabbedProperties.density); this.mass = this.getMass(grabbedProperties.dimensions, grabbedProperties.density);
var distanceToObject = Vec3.length(Vec3.subtract(MyAvatar.position, grabbedProperties.position)); var distanceToObject = Vec3.length(Vec3.subtract(MyAvatar.position, grabbedProperties.position));
var timeScale = this.distanceGrabTimescale(this.mass, distanceToObject); var timeScale = this.distanceGrabTimescale(this.mass, distanceToObject);
this.linearTimeScale = timeScale;
this.actionID = NULL_UUID; this.actionID = NULL_UUID;
this.actionID = Entities.addAction("spring", this.grabbedThingID, { this.actionID = Entities.addAction("spring", this.grabbedThingID, {
targetPosition: this.currentObjectPosition, targetPosition: this.currentObjectPosition,
@ -2615,7 +2615,6 @@ function MyController(hand) {
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition); var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition);
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, GRABBABLE_PROPERTIES); var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, GRABBABLE_PROPERTIES);
var now = Date.now(); var now = Date.now();
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
this.currentObjectTime = now; this.currentObjectTime = now;
@ -2663,11 +2662,9 @@ function MyController(hand) {
if (this.grabRadius < MINIMUM_GRAB_RADIUS) { if (this.grabRadius < MINIMUM_GRAB_RADIUS) {
this.grabRadius = MINIMUM_GRAB_RADIUS; this.grabRadius = MINIMUM_GRAB_RADIUS;
} }
var newTargetPosition = Vec3.multiply(this.grabRadius, Quat.getUp(worldControllerRotation)); var newTargetPosition = Vec3.multiply(this.grabRadius, Quat.getUp(worldControllerRotation));
newTargetPosition = Vec3.sum(newTargetPosition, worldControllerPosition); newTargetPosition = Vec3.sum(newTargetPosition, worldControllerPosition);
newTargetPosition = Vec3.sum(newTargetPosition, this.offsetPosition); newTargetPosition = Vec3.sum(newTargetPosition, this.offsetPosition);
var objectToAvatar = Vec3.subtract(this.currentObjectPosition, MyAvatar.position); var objectToAvatar = Vec3.subtract(this.currentObjectPosition, MyAvatar.position);
var handControllerData = getEntityCustomData('handControllerKey', this.grabbedThingID, defaultMoveWithHeadData); var handControllerData = getEntityCustomData('handControllerKey', this.grabbedThingID, defaultMoveWithHeadData);
if (handControllerData.disableMoveWithHead !== true) { if (handControllerData.disableMoveWithHead !== true) {
@ -2748,9 +2745,14 @@ function MyController(hand) {
this.setState(STATE_NEAR_GRABBING , "near grab entity '" + this.grabbedThingID + "'"); this.setState(STATE_NEAR_GRABBING , "near grab entity '" + this.grabbedThingID + "'");
return; return;
} }
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, { var success = Entities.updateAction(this.grabbedThingID, this.actionID, {
targetPosition: newTargetPosition, targetPosition: newTargetPosition,
linearTimeScale: this.distanceGrabTimescale(this.mass, distanceToObject), linearTimeScale: this.linearTimeScale,
targetRotation: this.currentObjectRotation, targetRotation: this.currentObjectRotation,
angularTimeScale: this.distanceGrabTimescale(this.mass, distanceToObject), angularTimeScale: this.distanceGrabTimescale(this.mass, distanceToObject),
ttl: ACTION_TTL ttl: ACTION_TTL