1
0
mirror of synced 2024-11-15 03:27:38 +01:00

More bone transform fixes

This commit is contained in:
KillzXGaming 2019-06-12 19:21:05 -04:00
parent c86a7b23ca
commit 74dc1c132c
6 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@ -334,7 +334,13 @@ namespace FirstPlugin
}
if (fshp.VertexSkinCount == 0)
{
Matrix4 NoBindFix = model.Skeleton.bones[fshp.BoneIndex].Transform;
int boneIndex = fshp.BoneIndex;
//Not often but some models use a bone index list instead
if (fshp.BoneIndices.Count > 0)
boneIndex = fshp.BoneIndices[0];
Matrix4 NoBindFix = model.Skeleton.bones[boneIndex].Transform;
v.pos = Vector3.TransformPosition(v.pos, NoBindFix);
v.nrm = Vector3.TransformNormal(v.nrm, NoBindFix);
}

View File

@ -287,7 +287,13 @@ namespace FirstPlugin
try
{
if (model.Skeleton.bones.Count > 0) {
Matrix4 NoBindFix = model.Skeleton.bones[fshp.BoneIndex].Transform;
int boneIndex = fshp.BoneIndex;
//Not often but some models use a bone index list instead
if (fshp.BoneIndices.Count > 0)
boneIndex = fshp.BoneIndices[0];
Matrix4 NoBindFix = model.Skeleton.bones[boneIndex].Transform;
v.pos = Vector3.TransformPosition(v.pos, NoBindFix);
v.nrm = Vector3.TransformNormal(v.nrm, NoBindFix);
}