fixing entitySelectionTool

This commit is contained in:
druiz17 2017-09-27 10:52:56 -07:00
parent 3500705d0c
commit 38096b48d9
2 changed files with 21 additions and 0 deletions

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,22 @@ SelectionDisplay = (function() {
}
};
that.checkControllerMove = function() {
if (SelectionManager.hasSelection()) {
var controllerPose = getControllerWorldLocation(activeHand, true);
var hand = (activeHand === Controller.Standard.LeftHand) ? 0 : 1;
print(hand);
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;