only make the last cm of the stylus active to avoid accidently closing tablet when grabbing base

This commit is contained in:
Seth Alves 2017-01-23 14:38:48 -08:00
parent cdb14e7662
commit 9d77e9937c
2 changed files with 3 additions and 33 deletions

View file

@ -63,6 +63,7 @@ var EQUIP_SPHERE_SCALE_FACTOR = 0.65;
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
var WEB_TOUCH_TOO_CLOSE = 0.04; // if the stylus is pushed far though the web surface, don't consider it touching
//
// distant manipulation
@ -1170,7 +1171,8 @@ function MyController(hand) {
if (nearWeb) {
this.showStylus();
var rayPickInfo = this.calcRayPickInfo(this.hand);
if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) {
if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET &&
rayPickInfo.distance > WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_TOO_CLOSE) {
this.handleStylusOnHomeButton(rayPickInfo);
if (this.handleStylusOnWebEntity(rayPickInfo)) {
return;

View file

@ -1,32 +0,0 @@
//
// HomeButton.js
//
// Created by Dante Ruiz on 12/6/2016
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function(){
_this = this;
this.preload = function(entityID) {
print(entityID);
this.entityID = entityID;
}
this.clickDownOnEntity = function(entityID, mouseEvent) {
Messages.sendLocalMessage("home", _this.entityID);
}
this.startNearTrigger = function() {
Messages.sendLocalMessage("home", _this.entityID);
}
this.startFarTrigger = function() {
Messages.sendLocalMessage("home", _this.entityID);
}
});