diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index d2f39f93de..fbad2c7f94 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -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; }