/// <summary> /// ローカル軸のついたボーンを生成する /// * forward: Z+ /// * axis: X+ /// </summary> public Bone(VrmLib.HumanoidBones bone, PrimitiveType primitive, Vector3 forward, Vector3 bendDir, float width, float depth, Vector3?offset = null) { var up = -bendDir; HumanBone = bone; m_width = width; m_depth = depth; m_offset = offset; Transform = new GameObject(bone.ToString()).transform; Shape = GameObject.CreatePrimitive(primitive).transform; var meshFilter = Shape.GetComponent <MeshFilter>(); meshFilter.sharedMesh = CopyMesh(meshFilter.sharedMesh); Shape.SetParent(Transform); var axis = Vector3.Cross(up, forward); var m = new Matrix4x4( axis, up, forward, new Vector4(0, 0, 0, 1) ); Transform.rotation = m.rotation; }
public static HumanBodyBones ToUnity(this VrmLib.HumanoidBones bone) { if (bone == VrmLib.HumanoidBones.unknown) { return(HumanBodyBones.LastBone); } return(VrmLib.EnumUtil.Cast <HumanBodyBones>(bone)); }
static void AssignHumanoid(List <Node> nodes, VrmProtobuf.HumanBone humanBone, VrmLib.HumanoidBones key) { if (humanBone.Node.HasValue) { nodes[humanBone.Node.Value].HumanoidBone = key; } }
static void AssignHumanoid(List <Node> nodes, UniGLTF.Extensions.VRMC_vrm.HumanBone humanBone, VrmLib.HumanoidBones key) { if (humanBone != null && humanBone.Node.HasValue) { nodes[humanBone.Node.Value].HumanoidBone = key; } }