From 450a52544142c75ca2c11f004d6f83176aa94232 Mon Sep 17 00:00:00 2001 From: HexaField Date: Mon, 8 Jul 2024 09:28:09 +1000 Subject: [PATCH] Fix regression with mouse wheel input not clearing properly --- .../client-core/src/components/Debug/styles.module.scss | 2 +- packages/spatial/src/input/systems/ClientInputSystem.tsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client-core/src/components/Debug/styles.module.scss b/packages/client-core/src/components/Debug/styles.module.scss index 1fd866a498..34784f0753 100644 --- a/packages/client-core/src/components/Debug/styles.module.scss +++ b/packages/client-core/src/components/Debug/styles.module.scss @@ -3,7 +3,7 @@ overflow-y: auto; top: 0; z-index: 100000; - height: 95vh; + max-height: 95vh; padding: 7px; width: calc(100vw - 50px); max-width: 600px; diff --git a/packages/spatial/src/input/systems/ClientInputSystem.tsx b/packages/spatial/src/input/systems/ClientInputSystem.tsx index 4180333b3e..ecb8247185 100755 --- a/packages/spatial/src/input/systems/ClientInputSystem.tsx +++ b/packages/spatial/src/input/systems/ClientInputSystem.tsx @@ -845,6 +845,12 @@ const cleanupInputs = () => { for (const key in source.buttons) { cleanupButton(key, source.buttons, hasFocus) } + + // clear non-spatial emulated axes data end of each frame + // this is used to clear wheel speed each frame + if (!hasComponent(eid, XRSpaceComponent) && hasComponent(eid, InputPointerComponent)) { + ;(source.source.gamepad!.axes as number[]).fill(0) + } } }