Merge pull request #11475 from druiz17/bugs

Fix EntitySelectioTool and improve far rotate
This commit is contained in:
Seth Alves 2017-09-27 14:05:35 -07:00 committed by GitHub
commit 2e92d40c8d
3 changed files with 21 additions and 5 deletions

View file

@ -369,11 +369,6 @@ Script.include("/~/system/libraries/controllers.js");
otherFarGrabModule.currentObjectRotation = Quat.multiply(controllerRotationDelta,
otherFarGrabModule.currentObjectRotation);
// Rotate about the translation controller's target position.
this.offsetPosition = Vec3.multiplyQbyV(controllerRotationDelta, this.offsetPosition);
otherFarGrabModule.offsetPosition = Vec3.multiplyQbyV(controllerRotationDelta,
otherFarGrabModule.offsetPosition);
this.previousWorldControllerRotation = worldControllerRotation;
};
@ -495,6 +490,7 @@ Script.include("/~/system/libraries/controllers.js");
}
if (otherFarGrabModule.grabbedThingID === this.grabbedThingID && otherFarGrabModule.distanceHolding) {
this.prepareDistanceRotatingData(controllerData);
this.distanceRotate(otherFarGrabModule);
} else {
this.distanceHolding = true;

View file

@ -1245,6 +1245,7 @@ var lastPosition = null;
Script.update.connect(function (deltaTime) {
progressDialog.move();
selectionDisplay.checkMove();
selectionDisplay.checkControllerMove();
var dOrientation = Math.abs(Quat.dot(Camera.orientation, lastOrientation) - 1);
var dPosition = Vec3.distance(Camera.position, lastPosition);
if (dOrientation > 0.001 || dPosition > 0.001) {

View file

@ -276,6 +276,10 @@ SelectionDisplay = (function() {
var overlayNames = [];
var lastCameraPosition = Camera.getPosition();
var lastCameraOrientation = Camera.getOrientation();
var lastControllerPoses = [
getControllerWorldLocation(Controller.Standard.LeftHand, true),
getControllerWorldLocation(Controller.Standard.RightHand, true)
];
var handleHoverColor = {
red: 224,
@ -4065,6 +4069,21 @@ SelectionDisplay = (function() {
}
};
that.checkControllerMove = function() {
if (SelectionManager.hasSelection()) {
var controllerPose = getControllerWorldLocation(activeHand, true);
var hand = (activeHand === Controller.Standard.LeftHand) ? 0 : 1;
if (controllerPose.valid && lastControllerPoses[hand].valid) {
if (!Vec3.equal(controllerPose.position, lastControllerPoses[hand].position) ||
!Vec3.equal(controllerPose.rotation, lastControllerPoses[hand].rotation)) {
print("setting controller pose");
that.mouseMoveEvent({});
}
}
lastControllerPoses[hand] = controllerPose;
}
};
// FUNCTION: MOUSE PRESS EVENT
that.mousePressEvent = function(event) {
var wantDebug = false;