From 045285f82d56cc935bee515233398589eb5cf41e Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Mon, 23 Dec 2024 18:34:19 +0000 Subject: [PATCH] Handle model files with too many joints --- KeepersCompound.LGS/ModelFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeepersCompound.LGS/ModelFile.cs b/KeepersCompound.LGS/ModelFile.cs index 38f1d83..1c68849 100644 --- a/KeepersCompound.LGS/ModelFile.cs +++ b/KeepersCompound.LGS/ModelFile.cs @@ -317,7 +317,7 @@ public class ModelFile var objTrans = Matrix4x4.Identity; if (subObj.Joint != -1) { - var ang = float.DegreesToRadians(joints[subObj.Joint]); + var ang = subObj.Joint >= joints.Length ? 0 : float.DegreesToRadians(joints[subObj.Joint]); // TODO: Is this correct? Should I use a manual rotation matrix? var jointRot = Matrix4x4.CreateFromYawPitchRoll(0, ang, 0); objTrans = jointRot * subObj.Transform;