Merge pull request #9456 from sethalves/tablet-ui

try again on haptics from touching tablet overlay with stylus
This commit is contained in:
Seth Alves 2017-01-20 11:07:59 -08:00 committed by GitHub
commit d449c6ca78

View file

@ -14,7 +14,7 @@
/* global getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset, setGrabCommunications,
Menu */
Menu, HMD */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() { // BEGIN LOCAL_SCOPE
@ -60,10 +60,6 @@ var PICK_WITH_HAND_RAY = true;
var EQUIP_SPHERE_SCALE_FACTOR = 0.65;
var WEB_TOUCH_SPHERE_RADIUS = 0.017;
var WEB_STYLUS_COLOR = { red: 0, green: 240, blue: 0 };
var WEB_STYLUS_TIP_COLOR = { red: 0, green: 0, blue: 240 };
var WEB_STYLUS_ALPHA = 1.0;
var WEB_DISPLAY_STYLUS_DISTANCE = 0.5;
var WEB_STYLUS_LENGTH = 0.2;
var WEB_TOUCH_Y_OFFSET = 0.05; // how far forward (or back with a negative number) to slide stylus in hand
@ -280,10 +276,6 @@ function distanceBetweenPointAndEntityBoundingBox(point, entityProps) {
return Vec3.distance(v, localPoint);
}
function angleBetween(a, b) {
return Math.acos(Vec3.dot(Vec3.normalize(a), Vec3.normalize(b)));
}
function projectOntoXYPlane(worldPos, position, rotation, dimensions, registrationPoint) {
var invRot = Quat.inverse(rotation);
var localPos = Vec3.multiplyQbyV(invRot, Vec3.subtract(worldPos, position));
@ -1247,7 +1239,7 @@ function MyController(hand) {
var homeButton = rayPickInfo.overlayID;
var hmdHomeButton = HMD.homeButtonID;
if (homeButton === hmdHomeButton) {
if (this.homeButtonTouched == false) {
if (this.homeButtonTouched === false) {
this.homeButtonTouched = true;
Controller.triggerHapticPulse(1, 20, this.hand);
Messages.sendLocalMessage("home", homeButton);
@ -1265,7 +1257,7 @@ function MyController(hand) {
var homeButton = rayPickInfo.overlayID;
var hmdHomeButton = HMD.homeButtonID;
if (homeButton === hmdHomeButton) {
if (this.homeButtonTouched == false) {
if (this.homeButtonTouched === false) {
this.homeButtonTouched = true;
Controller.triggerHapticPulse(1, 20, this.hand);
Messages.sendLocalMessage("home", homeButton);
@ -1777,7 +1769,9 @@ function MyController(hand) {
if (rayPickInfo.overlayID) {
var overlay = rayPickInfo.overlayID;
Controller.triggerHapticPulse(1, 20, this.hand);
if (!this.homeButtonTouched) {
Controller.triggerHapticPulse(1, 20, this.hand);
}
if (Overlays.keyboardFocusOverlay != overlay) {
Entities.keyboardFocusEntity = null;
@ -2039,9 +2033,7 @@ function MyController(hand) {
}
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
this.turnOffVisualizations();
this.previousRoomControllerPosition = roomControllerPosition;
};