From fae0277b6978284d8a51e423e29574008c33cdde Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:40:47 -0500 Subject: [PATCH] re apply rotation patch --- .../[...chunk_models_tanks]/[id]/model.glb.ts | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/packages/website/src/pages/[...chunk_models_tanks]/[id]/model.glb.ts b/packages/website/src/pages/[...chunk_models_tanks]/[id]/model.glb.ts index c4f5a5392..331af0ca4 100644 --- a/packages/website/src/pages/[...chunk_models_tanks]/[id]/model.glb.ts +++ b/packages/website/src/pages/[...chunk_models_tanks]/[id]/model.glb.ts @@ -107,14 +107,11 @@ export async function extractModel( break; case "TransformComponent": { - const localTranslation = component["tc.localTranslation"]; - // The game resets top-level node translation to [0, 0, 0] on load. - // Child nodes and customization parts must keep their authored - // local offsets. - node.setTranslation( - parent instanceof Scene && !isPart ? [0, 0, 0] : localTranslation, - ); - node.setRotation(component["tc.localRotation"]); + const t = component["tc.localTranslation"]; + const r = component["tc.localRotation"]; + + node.setTranslation([t[0], t[2], -t[1]]); + node.setRotation([r[0], r[2], -r[1], r[3]]); node.setScale(component["tc.localScale"]); break; @@ -184,10 +181,27 @@ export async function extractModel( } const vertexSize = vertexAttributeGltfVectorSizes[attribute]; + const processed = new Float32Array(value.flat()); + + if ( + attribute === VertexAttribute.VERTEX || + attribute === VertexAttribute.NORMAL || + attribute === VertexAttribute.TANGENT || + attribute === VertexAttribute.BINORMAL + ) { + for (let i = 0; i < processed.length; i += 3) { + const y = processed[i + 1]; + const z = processed[i + 2]; + + processed[i + 1] = z; + processed[i + 2] = -y; + } + } + const attributeAccessor = document .createAccessor(name) .setType(vertexSize === 1 ? "SCALAR" : `VEC${vertexSize}`) - .setArray(new Float32Array(value.flat())) + .setArray(processed) .setBuffer(buffer); primitive.setAttribute(name, attributeAccessor);