mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-03 23:53:09 +02:00
Improved stylus and laser input deadspot
This commit is contained in:
parent
49d8a644c3
commit
2fd691d844
1 changed files with 14 additions and 9 deletions
|
@ -2676,6 +2676,11 @@ function MyController(hand) {
|
|||
this.touchingEnterPointerEvent = pointerEvent;
|
||||
this.touchingEnterPointerEvent.button = "None";
|
||||
this.deadspotExpired = false;
|
||||
|
||||
var LASER_PRESS_TO_MOVE_DEADSPOT_ANGLE = 0.026; // radians ~ 1.2 degrees
|
||||
var STYLUS_PRESS_TO_MOVE_DEADSPOT_ANGLE = 0.314; // radians ~ 18 degrees
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2748,11 +2753,9 @@ function MyController(hand) {
|
|||
isPrimaryHeld: true
|
||||
};
|
||||
|
||||
var POINTER_PRESS_TO_MOVE_DELAY = 0.15; // seconds
|
||||
var POINTER_PRESS_TO_MOVE_DEADSPOT_ANGLE = 0.05; // radians ~ 3 degrees
|
||||
var POINTER_PRESS_TO_MOVE_DELAY = 0.25; // seconds
|
||||
if (this.deadspotExpired || this.touchingEnterTimer > POINTER_PRESS_TO_MOVE_DELAY ||
|
||||
angleBetween(pointerEvent.direction,
|
||||
this.touchingEnterPointerEvent.direction) > POINTER_PRESS_TO_MOVE_DEADSPOT_ANGLE) {
|
||||
Vec3.distance(intersectInfo.point, this.touchingEnterPointerEvent.pos3D) > this.deadspotRadius) {
|
||||
Entities.sendMouseMoveOnEntity(this.grabbedEntity, pointerEvent);
|
||||
Entities.sendHoldingClickOnEntity(this.grabbedEntity, pointerEvent);
|
||||
this.deadspotExpired = true;
|
||||
|
@ -2786,13 +2789,17 @@ function MyController(hand) {
|
|||
isPrimaryHeld: true
|
||||
};
|
||||
|
||||
|
||||
Overlays.sendMousePressOnOverlay(this.grabbedOverlay, pointerEvent);
|
||||
|
||||
this.touchingEnterTimer = 0;
|
||||
this.touchingEnterPointerEvent = pointerEvent;
|
||||
this.touchingEnterPointerEvent.button = "None";
|
||||
this.deadspotExpired = false;
|
||||
|
||||
var LASER_PRESS_TO_MOVE_DEADSPOT_ANGLE = 0.026; // radians ~ 1.2 degrees
|
||||
var STYLUS_PRESS_TO_MOVE_DEADSPOT_ANGLE = 0.314; // radians ~ 18 degrees
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2867,11 +2874,9 @@ function MyController(hand) {
|
|||
isPrimaryHeld: true
|
||||
};
|
||||
|
||||
var POINTER_PRESS_TO_MOVE_DELAY = 0.15; // seconds
|
||||
var POINTER_PRESS_TO_MOVE_DEADSPOT_ANGLE = 0.05; // radians ~ 3 degrees
|
||||
var POINTER_PRESS_TO_MOVE_DELAY = 0.25; // seconds
|
||||
if (this.deadspotExpired || this.touchingEnterTimer > POINTER_PRESS_TO_MOVE_DELAY ||
|
||||
angleBetween(pointerEvent.direction,
|
||||
this.touchingEnterPointerEvent.direction) > POINTER_PRESS_TO_MOVE_DEADSPOT_ANGLE) {
|
||||
Vec3.distance(intersectInfo.point, this.touchingEnterPointerEvent.pos3D) > this.deadspotRadius) {
|
||||
Overlays.sendMouseMoveOnOverlay(this.grabbedOverlay, pointerEvent);
|
||||
this.deadspotExpired = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue