You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
|
3 years ago
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using SiegeSong;
|
||
|
|
|
||
|
|
namespace SiegeSong
|
||
|
|
{
|
||
|
|
public static class SkinnedMeshExtension
|
||
|
|
{
|
||
|
|
public static void CopyBonesFrom(this Mesh target, Mesh source)
|
||
|
|
{
|
||
|
|
|
||
|
|
////create a dictionary referencing source bones by name
|
||
|
|
//Dictionary<string, Transform> boneMap = new Dictionary<string, Transform>();
|
||
|
|
//foreach (Transform bone in source.bones)
|
||
|
|
//{
|
||
|
|
// boneMap[bone.name] = bone;
|
||
|
|
//}
|
||
|
|
|
||
|
|
////match each bone name of the target to a bone from the source
|
||
|
|
//for (int i = 0; i < target.bones.Length; ++i)
|
||
|
|
//{
|
||
|
|
// string boneName = target.bones[i].name;
|
||
|
|
// if (!boneMap.TryGetValue(boneName, out target.bones[i]))
|
||
|
|
// {
|
||
|
|
// Debug.LogError(target.name + " failed to get the bone, " + boneName + ", from " + source.name);
|
||
|
|
// Debug.Break();
|
||
|
|
// }
|
||
|
|
//}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|