Handle model files with too many joints

This commit is contained in:
Jarrod Doyle 2024-12-23 18:34:19 +00:00
parent 65dda0194d
commit 045285f82d
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 1 additions and 1 deletions

View File

@ -317,7 +317,7 @@ public class ModelFile
var objTrans = Matrix4x4.Identity; var objTrans = Matrix4x4.Identity;
if (subObj.Joint != -1) 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? // TODO: Is this correct? Should I use a manual rotation matrix?
var jointRot = Matrix4x4.CreateFromYawPitchRoll(0, ang, 0); var jointRot = Matrix4x4.CreateFromYawPitchRoll(0, ang, 0);
objTrans = jointRot * subObj.Transform; objTrans = jointRot * subObj.Transform;