mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-03 14:18:47 +02:00
More consistent haptics on web overlays and entities
This commit is contained in:
parent
1ddafa3cee
commit
6738c0eade
1 changed files with 22 additions and 10 deletions
|
@ -27,7 +27,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
// add lines where the hand ray picking is happening
|
// add lines where the hand ray picking is happening
|
||||||
//
|
//
|
||||||
var WANT_DEBUG = false;
|
var WANT_DEBUG = false;
|
||||||
var WANT_DEBUG_STATE = false;
|
var WANT_DEBUG_STATE = true;
|
||||||
var WANT_DEBUG_SEARCH_NAME = null;
|
var WANT_DEBUG_SEARCH_NAME = null;
|
||||||
|
|
||||||
var FORCE_IGNORE_IK = false;
|
var FORCE_IGNORE_IK = false;
|
||||||
|
@ -53,6 +53,13 @@ var HAPTIC_TEXTURE_DISTANCE = 0.002;
|
||||||
var HAPTIC_DEQUIP_STRENGTH = 0.75;
|
var HAPTIC_DEQUIP_STRENGTH = 0.75;
|
||||||
var HAPTIC_DEQUIP_DURATION = 50.0;
|
var HAPTIC_DEQUIP_DURATION = 50.0;
|
||||||
|
|
||||||
|
// triggered when stylus presses a web overlay/entity
|
||||||
|
var HAPTIC_STYLUS_STRENGTH = 1.0;
|
||||||
|
var HAPTIC_STYLUS_DURATION = 20.0;
|
||||||
|
|
||||||
|
// triggerd when ui laser presses a web overlay/entity
|
||||||
|
var HAPTIC_LASER_UI_STRENGTH = 1.0;
|
||||||
|
var HAPTIC_LASER_UI_DURATION = 20.0;
|
||||||
|
|
||||||
var HAND_HEAD_MIX_RATIO = 0.0; // 0 = only use hands for search/move. 1 = only use head for search/move.
|
var HAND_HEAD_MIX_RATIO = 0.0; // 0 = only use hands for search/move. 1 = only use head for search/move.
|
||||||
|
|
||||||
|
@ -122,7 +129,6 @@ var GRAB_POINT_SPHERE_RADIUS = NEAR_GRAB_RADIUS;
|
||||||
var GRAB_POINT_SPHERE_COLOR = { red: 240, green: 240, blue: 240 };
|
var GRAB_POINT_SPHERE_COLOR = { red: 240, green: 240, blue: 240 };
|
||||||
var GRAB_POINT_SPHERE_ALPHA = 0.85;
|
var GRAB_POINT_SPHERE_ALPHA = 0.85;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// other constants
|
// other constants
|
||||||
//
|
//
|
||||||
|
@ -1248,7 +1254,7 @@ function MyController(hand) {
|
||||||
if (homeButton === hmdHomeButton) {
|
if (homeButton === hmdHomeButton) {
|
||||||
if (this.homeButtonTouched === false) {
|
if (this.homeButtonTouched === false) {
|
||||||
this.homeButtonTouched = true;
|
this.homeButtonTouched = true;
|
||||||
Controller.triggerHapticPulse(1, 20, this.hand);
|
Controller.triggerHapticPulse(HAPTIC_STYLUS_STRENGTH, HAPTIC_STYLUS_DURATION, this.hand);
|
||||||
Messages.sendLocalMessage("home", homeButton);
|
Messages.sendLocalMessage("home", homeButton);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1266,7 +1272,7 @@ function MyController(hand) {
|
||||||
if (homeButton === hmdHomeButton) {
|
if (homeButton === hmdHomeButton) {
|
||||||
if (this.homeButtonTouched === false) {
|
if (this.homeButtonTouched === false) {
|
||||||
this.homeButtonTouched = true;
|
this.homeButtonTouched = true;
|
||||||
Controller.triggerHapticPulse(1, 20, this.hand);
|
Controller.triggerHapticPulse(HAPTIC_LASER_UI_STRENGTH, HAPTIC_LASER_UI_DURATION, this.hand);
|
||||||
Messages.sendLocalMessage("home", homeButton);
|
Messages.sendLocalMessage("home", homeButton);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1754,7 +1760,6 @@ function MyController(hand) {
|
||||||
Entities.sendHoverOverEntity(entity, pointerEvent);
|
Entities.sendHoverOverEntity(entity, pointerEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.grabbedEntity = entity;
|
this.grabbedEntity = entity;
|
||||||
this.setState(STATE_ENTITY_STYLUS_TOUCHING, "begin touching entity '" + name + "'");
|
this.setState(STATE_ENTITY_STYLUS_TOUCHING, "begin touching entity '" + name + "'");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1775,11 +1780,6 @@ function MyController(hand) {
|
||||||
var pointerEvent;
|
var pointerEvent;
|
||||||
if (rayPickInfo.overlayID) {
|
if (rayPickInfo.overlayID) {
|
||||||
var overlay = rayPickInfo.overlayID;
|
var overlay = rayPickInfo.overlayID;
|
||||||
|
|
||||||
if (!this.homeButtonTouched) {
|
|
||||||
Controller.triggerHapticPulse(1, 20, this.hand);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Overlays.keyboardFocusOverlay != overlay) {
|
if (Overlays.keyboardFocusOverlay != overlay) {
|
||||||
Entities.keyboardFocusEntity = null;
|
Entities.keyboardFocusEntity = null;
|
||||||
Overlays.keyboardFocusOverlay = overlay;
|
Overlays.keyboardFocusOverlay = overlay;
|
||||||
|
@ -2710,6 +2710,12 @@ function MyController(hand) {
|
||||||
var theta = this.state === STATE_ENTITY_STYLUS_TOUCHING ? STYLUS_PRESS_TO_MOVE_DEADSPOT_ANGLE : LASER_PRESS_TO_MOVE_DEADSPOT_ANGLE;
|
var theta = this.state === STATE_ENTITY_STYLUS_TOUCHING ? STYLUS_PRESS_TO_MOVE_DEADSPOT_ANGLE : LASER_PRESS_TO_MOVE_DEADSPOT_ANGLE;
|
||||||
this.deadspotRadius = Math.tan(theta) * intersectInfo.distance; // dead spot radius in meters
|
this.deadspotRadius = Math.tan(theta) * intersectInfo.distance; // dead spot radius in meters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.state == STATE_ENTITY_STYLUS_TOUCHING) {
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_STYLUS_STRENGTH, HAPTIC_STYLUS_DURATION, this.hand);
|
||||||
|
} else if (this.state == STATE_ENTITY_LASER_TOUCHING) {
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_LASER_UI_STRENGTH, HAPTIC_LASER_UI_DURATION, this.hand);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.entityTouchingExit = function() {
|
this.entityTouchingExit = function() {
|
||||||
|
@ -2829,6 +2835,12 @@ function MyController(hand) {
|
||||||
var theta = this.state === STATE_OVERLAY_STYLUS_TOUCHING ? STYLUS_PRESS_TO_MOVE_DEADSPOT_ANGLE : LASER_PRESS_TO_MOVE_DEADSPOT_ANGLE;
|
var theta = this.state === STATE_OVERLAY_STYLUS_TOUCHING ? STYLUS_PRESS_TO_MOVE_DEADSPOT_ANGLE : LASER_PRESS_TO_MOVE_DEADSPOT_ANGLE;
|
||||||
this.deadspotRadius = Math.tan(theta) * intersectInfo.distance; // dead spot radius in meters
|
this.deadspotRadius = Math.tan(theta) * intersectInfo.distance; // dead spot radius in meters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.state == STATE_OVERLAY_STYLUS_TOUCHING) {
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_STYLUS_STRENGTH, HAPTIC_STYLUS_DURATION, this.hand);
|
||||||
|
} else if (this.state == STATE_OVERLAY_LASER_TOUCHING) {
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_LASER_UI_STRENGTH, HAPTIC_LASER_UI_DURATION, this.hand);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.overlayTouchingExit = function () {
|
this.overlayTouchingExit = function () {
|
||||||
|
|
Loading…
Reference in a new issue