Ejemplo n.º 1
0
    void PlaySimilarMotion(GameObject go0, GameObject go1)
    {
        var cost = ms_.GetCostEstimate();
        int i    = MotionSimilarity.FindSmallestAfter(cost, CurrIndex, float.NegativeInfinity, float.PositiveInfinity);

        Debug.LogFormat("curr {0} index {1} value {2}", CurrIndex, i, cost[i]);
        CurrIndex++;

        var miniFrame = ms_.MotionFrameByIndex(i);

        int motion = 0, beat = 0;

        ms_.IndexToMotionClip(miniFrame.index0, ref motion, ref beat);
        var frame = ms_.GetFrameData(motion);

        PrepareSimilarMotion(go0, frame, beat);

        Debug.LogFormat("mini cost {0}, song {1} beat {2}",
                        miniFrame.minCost, frame.name, beat);

        ms_.IndexToMotionClip(miniFrame.index1, ref motion, ref beat);
        frame = ms_.GetFrameData(motion);
        PrepareSimilarMotion(go1, frame, beat);

        Debug.LogFormat("mini cost {0}, song {1} beat {2}",
                        miniFrame.minCost, frame.name, beat);
    }
Ejemplo n.º 2
0
    public static void TestMotionFrameByIndex()
    {
        MotionSimilarity ms = new MotionSimilarity();

        ms.CalcMotionSimilarity(new DummyUpdater());

        var cost = ms.GetCostEstimate();

        for (int i = 0; i < 10; i++)
        {
            int   ii    = MotionSimilarity.FindSmallestAfter(cost, i, float.NegativeInfinity, float.PositiveInfinity);
            var   frame = ms.MotionFrameByIndex(ii);
            float c     = MotionSimilarity.MotionSeqCost(ms.quat_, frame.index0, frame.index1);
            Debug.LogFormat("cost 0 {0} cost 1 {1}", cost[ii], c);
        }

        var largest = MotionSimilarity.FindLargestAfter(cost, 0, float.NegativeInfinity, float.PositiveInfinity);

        Debug.LogFormat("largest value {0}", cost[largest]);
    }