Exemple #1
0
        private void RenderTransformPath(TransformCurves transformCurves, float length, float samplingDelta)
        {
            float t = 0;

            int numberSamples = Mathf.RoundToInt(length / samplingDelta) + 1;

            float delta = length / numberSamples;

            Vector3[] pts = new Vector3[numberSamples];

            int index = 0;

            while (index < numberSamples)
            {
                pts[index++] = transformCurves.GetPosition(t);
                t           += delta;
            }

            if (index != pts.Length)
            {
                Debug.LogError("Number of samples doesn't match: " + (index + 1) + " instead of " + pts.Length);
            }

            Handles.DrawPolyLine(pts);
        }
Exemple #2
0
        private void RenderTransformAnimation(TransformCurves transformCurves, float time)
        {
            Vector3    pos   = transformCurves.GetPosition(time);//new Vector3( xPos.Evaluate(t), yPos.Evaluate(t), zPos.Evaluate(t) );
            Quaternion rot   = transformCurves.GetRotation(time);
            Vector3    scale = transformCurves.GetScale(time);

            transformCurves.bone.localScale    = scale;
            transformCurves.bone.localRotation = rot;
            transformCurves.bone.localPosition = pos;

            Handles.RectangleCap(0, pos, rot, 0.1f);
            Handles.RectangleCap(0, pos + rot * Vector3.forward, rot, 0.4f);
        }