コード例 #1
0
            /// <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;
            }
コード例 #2
0
 public static HumanBodyBones ToUnity(this VrmLib.HumanoidBones bone)
 {
     if (bone == VrmLib.HumanoidBones.unknown)
     {
         return(HumanBodyBones.LastBone);
     }
     return(VrmLib.EnumUtil.Cast <HumanBodyBones>(bone));
 }
コード例 #3
0
ファイル: Vrm10Storage.cs プロジェクト: vrm-c/UniVRM_1_0
 static void AssignHumanoid(List <Node> nodes, VrmProtobuf.HumanBone humanBone, VrmLib.HumanoidBones key)
 {
     if (humanBone.Node.HasValue)
     {
         nodes[humanBone.Node.Value].HumanoidBone = key;
     }
 }
コード例 #4
0
ファイル: Vrm10Storage.cs プロジェクト: nowsprinting/UniVRM
 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;
     }
 }