From 498f93c4d47291772da558b73cac00197b6dffa1 Mon Sep 17 00:00:00 2001 From: Kythyria Tieran Date: Fri, 13 Oct 2023 00:34:21 +0100 Subject: [PATCH] Force object transforms to be decomposable --- PD2ModelParser/Exporters/GltfExporter.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PD2ModelParser/Exporters/GltfExporter.cs b/PD2ModelParser/Exporters/GltfExporter.cs index 4408f8c..eded1a7 100644 --- a/PD2ModelParser/Exporters/GltfExporter.cs +++ b/PD2ModelParser/Exporters/GltfExporter.cs @@ -109,7 +109,11 @@ void CreateNodeFromObject3D(Object3D thing, GLTF.IVisualNodeContainer parent) var mat = thing.Transform; mat.Translation = mat.Translation * scaleFactor; - // Some models in the wild need this doing to them, god knows why + // Some models in the wild need this doing to them, god knows why, + // but bogus fourth rows are a thing. + mat.M14 = 0; + mat.M24 = 0; + mat.M34 = 0; mat.M44 = 1; node.LocalMatrix = isSkinned ? Matrix4x4.Identity : mat;