From c2c586c2e7e46f47e2481fb8d313d642c0027343 Mon Sep 17 00:00:00 2001 From: Mark Greene Date: Sun, 4 Oct 2026 20:00:51 +1300 Subject: [PATCH] Fix: scroll track textures at the same rate Dragging a tank's track scrolled its roughness/metalness texture at twice the speed of the base color and normal textures, so highlights drifted off the track links. **Cause** - `translateTexture` added the scroll offset to `roughnessMap` and `metalnessMap` separately - glTF has a single metallic-roughness texture, and the loader assigns that same texture object to both slots, so it received the offset twice **Changes** - Collect the track's maps in a `Set` before scrolling so a texture shared between slots is offset exactly once --- .../TankSandbox/components/TankModel.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TankModel.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TankModel.tsx index ded24bba1..c74722bff 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TankModel.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TankModel.tsx @@ -51,11 +51,17 @@ export function TankModel() { invalidate(); - if (material.map) material.map.offset.y += offset; - if (material.aoMap) material.aoMap.offset.y += offset; - if (material.normalMap) material.normalMap.offset.y += offset; - if (material.roughnessMap) material.roughnessMap.offset.y += offset; - if (material.metalnessMap) material.metalnessMap.offset.y += offset; + const textures = new Set([ + material.map, + material.aoMap, + material.normalMap, + material.roughnessMap, + material.metalnessMap, + ]); + + for (const texture of textures) { + if (texture) texture.offset.y += offset; + } } function onPointerDown(event: ThreeEvent) {