don't do constant haptics if stylus touches tablet frame. home button triggers only once per click

This commit is contained in:
Seth Alves 2017-01-18 16:56:39 -08:00
parent c4d85c91d0
commit 7c938728e5
2 changed files with 13 additions and 5 deletions

View file

@ -929,7 +929,7 @@ glm::quat Avatar::getAbsoluteJointRotationInObjectFrame(int index) const {
}
case CAMERA_MATRIX_INDEX: {
glm::quat rotation;
if (_skeletonModel) {
if (_skeletonModel && _skeletonModel->isActive()) {
int headJointIndex = _skeletonModel->getFBXGeometry().headJointIndex;
if (headJointIndex >= 0) {
_skeletonModel->getAbsoluteJointRotationInRigFrame(headJointIndex, rotation);
@ -965,7 +965,7 @@ glm::vec3 Avatar::getAbsoluteJointTranslationInObjectFrame(int index) const {
}
case CAMERA_MATRIX_INDEX: {
glm::vec3 translation;
if (_skeletonModel) {
if (_skeletonModel && _skeletonModel->isActive()) {
int headJointIndex = _skeletonModel->getFBXGeometry().headJointIndex;
if (headJointIndex >= 0) {
_skeletonModel->getAbsoluteJointTranslationInRigFrame(headJointIndex, translation);

View file

@ -737,6 +737,7 @@ function MyController(hand) {
this.autoUnequipCounter = 0;
this.grabPointIntersectsEntity = false;
this.stylus = null;
this.homeButtonTouched = false;
// Until there is some reliable way to keep track of a "stack" of parentIDs, we'll have problems
// when more than one avatar does parenting grabs on things. This script tries to work
@ -1178,13 +1179,13 @@ function MyController(hand) {
this.showStylus();
var rayPickInfo = this.calcRayPickInfo(this.hand);
if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) {
this.handleStylusOnHomeButton(rayPickInfo);
if (this.handleStylusOnWebEntity(rayPickInfo)) {
return;
}
if (this.handleStylusOnWebOverlay(rayPickInfo)) {
return;
}
this.handleStylusOnHomeButton(rayPickInfo);
}
} else {
this.hideStylus();
@ -1246,8 +1247,16 @@ function MyController(hand) {
var entity = rayPickInfo.entityID;
var name = entityPropertiesCache.getProps(entity).name;
if (name == "homeButton") {
Messages.sendLocalMessage("home", entity);
if (this.homeButtonTouched == false) {
this.homeButtonTouched = true;
Controller.triggerHapticPulse(1, 20, this.hand);
Messages.sendLocalMessage("home", entity);
}
} else {
this.homeButtonTouched = false;
}
} else {
this.homeButtonTouched = false;
}
};
@ -1679,7 +1688,6 @@ function MyController(hand) {
};
this.handleStylusOnWebEntity = function (rayPickInfo) {
Controller.triggerHapticPulse(1, 20, this.hand);
var pointerEvent;
if (rayPickInfo.entityID && Entities.wantsHandControllerPointerEvents(rayPickInfo.entityID)) {