コード例 #1
0
    public static void CalcRelativeMat(Bone bone, Matrix4x4 parentOffsteMat)
    {
        foreach (Bone childBone in bone.children)
        {
            Bone.CalcRelativeMat(childBone, bone.matrixOffset);
        }

        if (parentOffsteMat != null)
        {
            bone.matrixInit = bone.matrixInit * parentOffsteMat;
        }
    }
コード例 #2
0
    public void Create(Vector3 pos, int start)
    {
        m_planeData  = new PlaneData();
        m_startIndex = start;

        Matrix4x4 mat0 = MatrixUtils.RotateX((-90.0f * Mathf.PI) / 180);
        Matrix4x4 mat1 = MatrixUtils.RotateX((90.0f * Mathf.PI) / 180);

        mat0.m30 = 0.0000f;
        mat0.m31 = 0.5f;

        mat1.m30 = 0.0000f;
        mat1.m31 = 1.5f;


        Bone rootBone = new Bone(mat0);

        bones.Add(rootBone);
        bones.Add(new Bone(mat1));

        gmat = Matrix4x4.identity;
        for (int i = 0; i < bones.Count; i++)
        {
            combMatArr.Add(Matrix4x4.identity);
        }

        // relationship between parent and childs
        bones[0].Add(bones[1]);


        Bone.CalcRelativeMat(bones[0], gmat);

        for (int i = 0; i < newPos.Length; i++)
        {
            newPos [i] = Vector3.zero;
        }

        CreatePlane(pos);
    }