예제 #1
0
    void drawGizmos(Color color)
    {
        var oldColor = Gizmos.color;

        Gizmos.color = color;

        var pos = transform.position;
        var rot = transform.rotation;

        var q = DualQuaternion.fromUnityTransform(rot, pos);        //new DualQuaternion(rot.conjugate(), pos);//o_O Well, whatever.

        drawDualQuaternion(q);

        foreach (Transform cur in transform)
        {
            var childQ = DualQuaternion.fromUnityTransform(cur.transform.localRotation, cur.transform.localPosition);
            //new DualQuaternion(cur.transform.localRotation.conjugate(), cur.transform.localPosition);

            var childQ2 = q * childQ;

            drawDualQuaternion(childQ2);

            const int numSteps = 10;
            for (int i = 1; i < numSteps; i++)
            {
                float t    = (float)i / (float)numSteps;
                var   tmpQ = q.sclerp(childQ2, t);
                drawDualQuaternion(tmpQ);
            }
        }

        Gizmos.color = oldColor;
    }