Пример #1
0
    public void Draw(Color boneColor, Color jointColor, float alpha)
    {
        UltiDraw.Begin();
        if (DrawRoot)
        {
            UltiDraw.DrawTranslateGizmo(GetRoot().position, GetRoot().rotation, 0.1f);
            UltiDraw.DrawSphere(GetRoot().position, GetRoot().rotation, 0.025f, UltiDraw.Black);
            UltiDraw.DrawLine(Bones[0].Transform.position, GetRoot().position, UltiDraw.Mustard);
        }

        if (DrawSkeleton)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                if (bone.GetParent() != null)
                {
                    //if(bone.GetLength() > 0.05f) {
                    UltiDraw.DrawBone(
                        bone.GetParent().Transform.position,
                        Quaternion.FromToRotation(bone.GetParent().Transform.forward, bone.Transform.position - bone.GetParent().Transform.position) * bone.GetParent().Transform.rotation,
                        12.5f * BoneSize * bone.GetLength(), bone.GetLength(),
                        boneColor.Transparent(alpha)
                        );
                    //}
                }
                UltiDraw.DrawSphere(
                    bone.Transform.position,
                    Quaternion.identity,
                    5f / 8f * BoneSize,
                    jointColor.Transparent(alpha)
                    );
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }

        if (DrawTransforms)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                UltiDraw.DrawTranslateGizmo(bone.Transform.position, bone.Transform.rotation, 0.05f);
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }
        UltiDraw.End();
    }
Пример #2
0
    public void Draw(Color boneColor, Color jointColor, float alpha)
    {
        UltiDraw.Begin();

        if (DrawSkeleton)
        {
            Action <Segment, Segment> recursion = null;
            recursion = new Action <Segment, Segment>((segment, parent) => {
                if (segment == null)
                {
                    return;
                }
                if (parent != null)
                {
                    UltiDraw.DrawSphere(
                        parent.GetTransformation().GetPosition(),
                        Quaternion.identity,
                        5f / 8f * BoneSize,
                        jointColor.Transparent(alpha)
                        );
                    float distance = Vector3.Distance(parent.GetTransformation().GetPosition(), segment.GetTransformation().GetPosition());
                    if (distance > 0.05f)
                    {
                        UltiDraw.DrawBone(
                            parent.GetTransformation().GetPosition(),
                            Quaternion.FromToRotation(parent.GetTransformation().GetForward(), segment.GetTransformation().GetPosition() - parent.GetTransformation().GetPosition()) * parent.GetTransformation().GetRotation(),
                            4f * BoneSize, distance,
                            boneColor.Transparent(alpha)
                            );
                    }
                }
                parent = segment;
                for (int i = 0; i < segment.GetChildCount(); i++)
                {
                    recursion(segment.GetChild(Hierarchy, i), parent);
                }
            });
            recursion(GetRoot(), null);
        }

        if (DrawTransforms)
        {
            Action <Segment> recursion = null;
            recursion = new Action <Segment>((segment) => {
                //UltiDraw.DrawArrow(segment.GetTransformation().GetPosition(), segment.GetTransformation().GetPosition() + 0.05f * (segment.GetTransformation().GetRotation() * Vector3.forward), 0.75f, 0.005f, 0.025f, Color.blue);
                //UltiDraw.DrawArrow(segment.GetTransformation().GetPosition(), segment.GetTransformation().GetPosition() + 0.05f * (segment.GetTransformation().GetRotation() * Vector3.up), 0.75f, 0.005f, 0.025f, Color.green);
                //UltiDraw.DrawArrow(segment.GetTransformation().GetPosition(), segment.GetTransformation().GetPosition() + 0.05f * (segment.GetTransformation().GetRotation() * Vector3.right), 0.75f, 0.005f, 0.025f, Color.red);
                UltiDraw.DrawTranslateGizmo(segment.GetTransformation().GetPosition(), segment.GetTransformation().GetRotation(), 0.05f);
                for (int i = 0; i < segment.GetChildCount(); i++)
                {
                    recursion(segment.GetChild(Hierarchy, i));
                }
            });
            recursion(GetRoot());
        }

        UltiDraw.End();
    }
Пример #3
0
 void OnDrawGizmos()
 {
     UltiDraw.Begin();
     //
     UltiDraw.DrawBone(
         transform.position,
         Quaternion.FromToRotation(-transform.parent.forward, transform.position - transform.parent.position) * transform.parent.rotation,
         0.5f,
         (transform.position - transform.parent.position).magnitude, UltiDraw.IndianRed);
     //
     UltiDraw.End();
 }
Пример #4
0
    void Draw()
    {
        UltiDraw.Begin();

        Action <Transform, Transform> recursion = null;

        recursion = new Action <Transform, Transform>((segment, parent) => {
            if (segment == null)
            {
                return;
            }
            if (parent != null)
            {
                UltiDraw.DrawSphere(
                    parent.position,
                    parent.rotation,
                    5f / 8f * BoneSize,
                    JointColor
                    );
                float distance = Vector3.Distance(parent.position, segment.position);
                if (distance > 0.05f)
                {
                    UltiDraw.DrawBone(
                        parent.position,
                        Quaternion.FromToRotation(parent.forward, segment.position - parent.position) * parent.rotation,
                        4f * BoneSize, distance,
                        BoneColor
                        );
                }
            }
            parent = segment;
            for (int i = 0; i < segment.childCount; i++)
            {
                recursion(segment.GetChild(i), parent);
            }
        });
        recursion(transform, null);

        if (DrawTransforms)
        {
            Action <Transform> f = null;
            f = new Action <Transform>((segment) => {
                UltiDraw.DrawTranslateGizmo(segment.position, segment.rotation, 0.075f);
                for (int i = 0; i < segment.childCount; i++)
                {
                    f(segment.GetChild(i));
                }
            });
            f(transform);
        }

        UltiDraw.End();
    }
Пример #5
0
 public void Draw(Matrix4x4[] transformations, Color color)
 {
     UltiDraw.Begin();
     if (transformations.Length != Bones.Length)
     {
         Debug.Log("Number of given transformations does not match number of bones.");
     }
     else
     {
         Action <Bone> recursion = null;
         recursion = new Action <Bone>((bone) => {
             Matrix4x4 current = transformations[bone.Index];
             if (bone.GetParent() != null)
             {
                 Matrix4x4 parent = transformations[bone.GetParent().Index];
                 UltiDraw.DrawBone(
                     parent.GetPosition(),
                     Quaternion.FromToRotation(parent.GetForward(), current.GetPosition() - parent.GetPosition()) * parent.GetRotation(),
                     12.5f * BoneSize * bone.GetLength(), bone.GetLength(),
                     color
                     );
             }
             UltiDraw.DrawSphere(
                 current.GetPosition(),
                 Quaternion.identity,
                 5f / 8f * BoneSize,
                 color
                 );
             for (int i = 0; i < bone.Childs.Length; i++)
             {
                 recursion(bone.GetChild(i));
             }
         });
         foreach (Bone bone in GetRootBones())
         {
             recursion(bone);
         }
     }
     UltiDraw.End();
 }
Пример #6
0
 void OnDrawGizmos()
 {
     UltiDraw.Begin();
     UltiDraw.DrawBone(transform.position, Quaternion.identity, 0.5f, (transform.position - transform.parent.position).magnitude, UltiDraw.IndianRed);
     UltiDraw.End();
 }
Пример #7
0
    public void Draw(Color boneColor, Color jointColor, float alpha)
    {
        UltiDraw.Begin();

        if (DrawSkeleton)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) =>
            {
                if (bone.Visiable)
                {
                    if (bone.GetParent() != null)
                    {
                        UltiDraw.DrawBone
                        (
                            bone.GetParent().Transform.position,
                            Quaternion.FromToRotation(bone.GetParent().Transform.forward, bone.Transform.position - bone.GetParent().Transform.position) * bone.GetParent().Transform.rotation,
                            12.5f * BoneSize * bone.GetLength(), bone.GetLength(),
                            boneColor.Transparent(alpha)
                        );
                    }
                    UltiDraw.DrawSphere(
                        bone.Transform.position,
                        Quaternion.identity,
                        3f / 8f * BoneSize,
                        jointColor.Transparent(alpha)
                        );
                }
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }

        if (DrawVelocities)
        {
            for (int i = 0; i < Bones.Length; i++)
            {
                if (Bones[i].Visiable)
                {
                    UltiDraw.DrawArrow(
                        Bones[i].Transform.position,
                        Bones[i].Transform.position + Bones[i].Velocity,
                        0.25f,
                        0.025f,
                        0.2f,
                        UltiDraw.DarkGreen.Transparent(0.5f)
                        );
                }
            }
        }

        if (DrawTransforms)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) =>
            {
                if (bone.Visiable)
                {
                    UltiDraw.DrawTranslateGizmo(bone.Transform.position, bone.Transform.rotation, 0.05f);
                    for (int i = 0; i < bone.Childs.Length; i++)
                    {
                        recursion(bone.GetChild(i));
                    }
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }

        UltiDraw.End();
    }
Пример #8
0
 void OnDrawGizmos()
 {
     UltiDraw.Begin();
     UltiDraw.DrawBone(transform.position, Quaternion.LookRotation(-(transform.localPosition).normalized, transform.parent.up), 0.5f, (transform.position - transform.parent.position).magnitude, UltiDraw.Blue.Transparent(0.8f));
     UltiDraw.End();
 }
Пример #9
0
    public void Draw(Color boneColor, Color jointColor, float alpha)
    {
        UltiDraw.Begin();
        if (DrawRoot)
        {
            UltiDraw.DrawWiredSphere(GetRoot().position, GetRoot().rotation, 0.1f, UltiDraw.DarkRed, UltiDraw.Black);
            UltiDraw.DrawTranslateGizmo(GetRoot().position, GetRoot().rotation, 0.1f);
        }

        if (DrawSkeleton)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                if (bone.GetParent() != null)
                {
                    //if(bone.GetLength() > 0.05f) {
                    UltiDraw.DrawBone(
                        bone.GetParent().Transform.position,
                        Quaternion.FromToRotation(bone.GetParent().Transform.forward, bone.Transform.position - bone.GetParent().Transform.position) * bone.GetParent().Transform.rotation,
                        12.5f * BoneSize * bone.GetLength(), bone.GetLength(),
                        boneColor.Transparent(alpha)
                        );
                    //}
                }
                UltiDraw.DrawSphere(
                    bone.Transform.position,
                    Quaternion.identity,
                    5f / 8f * BoneSize,
                    jointColor.Transparent(alpha)
                    );
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }

        if (DrawVelocities)
        {
            for (int i = 0; i < Bones.Length; i++)
            {
                UltiDraw.DrawArrow(
                    Bones[i].Transform.position,
                    Bones[i].Transform.position + Bones[i].Velocity,
                    0.75f,
                    0.0075f,
                    0.05f,
                    UltiDraw.DarkGreen.Transparent(0.5f)
                    );
            }
        }

        if (DrawAccelerations)
        {
            for (int i = 0; i < Bones.Length; i++)
            {
                UltiDraw.DrawArrow(
                    Bones[i].Transform.position,
                    Bones[i].Transform.position + Bones[i].Acceleration,
                    0.75f,
                    0.0075f,
                    0.05f,
                    UltiDraw.DarkBlue.Transparent(0.5f)
                    );
            }
        }

        if (DrawForces)
        {
            for (int i = 0; i < Bones.Length; i++)
            {
                UltiDraw.DrawArrow(
                    Bones[i].Transform.position,
                    Bones[i].Transform.position + Bones[i].Force,
                    0.75f,
                    0.0075f,
                    0.05f,
                    UltiDraw.DarkRed.Transparent(0.5f)
                    );
            }
        }

        if (DrawTransforms)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                UltiDraw.DrawTranslateGizmo(bone.Transform.position, bone.Transform.rotation, 0.05f);
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }
        UltiDraw.End();

        if (DrawHistory)
        {
            if (DrawSkeleton)
            {
                for (int i = 0; i < History.Count; i++)
                {
                    Sketch(History[i].Transformations, UltiDraw.GetRainbowColor(Index, 2).Transparent(0.5f));
                }
            }
            if (DrawVelocities)
            {
                float          max       = 0f;
                List <float[]> functions = new List <float[]>();
                for (int i = 0; i < Bones.Length; i++)
                {
                    float[] function = new float[History.Count];
                    for (int j = 0; j < function.Length; j++)
                    {
                        function[j] = History[j].Velocities[i].magnitude;
                        max         = Mathf.Max(max, function[j]);
                    }
                    functions.Add(function);
                }
                UltiDraw.Begin();
                UltiDraw.DrawGUIFunctions(new Vector2(0.5f, 0.05f), new Vector2(0.9f, 0.1f), functions, 0f, max, 0.0025f, UltiDraw.DarkGrey, UltiDraw.GetRainbowColors(functions.Count));
                UltiDraw.End();
            }
            if (DrawAccelerations)
            {
                float          max       = 0f;
                List <float[]> functions = new List <float[]>();
                for (int i = 0; i < Bones.Length; i++)
                {
                    float[] function = new float[History.Count];
                    for (int j = 0; j < function.Length; j++)
                    {
                        function[j] = History[j].Accelerations[i].magnitude;
                        max         = Mathf.Max(max, function[j]);
                    }
                    functions.Add(function);
                }
                UltiDraw.Begin();
                UltiDraw.DrawGUIFunctions(new Vector2(0.5f, 0.175f), new Vector2(0.9f, 0.1f), functions, 0f, max, 0.0025f, UltiDraw.DarkGrey, UltiDraw.GetRainbowColors(functions.Count));
                UltiDraw.End();
            }
        }
    }
Пример #10
0
    void Draw()
    {
        float speed   = 100f;
        float spacing = 1.5f;
        float height  = 1f;
        int   index   = 0;

        Color[] colors = UltiDraw.GetRainbowColors(9);

        UltiDraw.Begin();

        UltiDraw.SetDepthRendering(DepthRendering);

        UltiDraw.SetCurvature(0f);
        UltiDraw.DrawQuad(Vector3.zero, Quaternion.Euler(90f, 0f, 0f), 100f, 100f, UltiDraw.DarkGrey);
        UltiDraw.SetCurvature(0.25f);

        UltiDraw.DrawGrid(Vector3.zero, Quaternion.identity, 100, 100, 1f, 1f, UltiDraw.DarkGreen.Transparent(0.5f));

        UltiDraw.DrawWireCube(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]);
        UltiDraw.DrawCube(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]);
        UltiDraw.DrawWiredCube(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireSphere(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]);
        UltiDraw.DrawSphere(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]);
        UltiDraw.DrawWiredSphere(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireCapsule(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]);
        UltiDraw.DrawCapsule(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]);
        UltiDraw.DrawWiredCapsule(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireBone(new Vector3(index * spacing, height - 0.5f, 0f * spacing), Quaternion.Euler(-90f, speed * Time.time, 0f), 1f, 1f, colors[index]);
        UltiDraw.DrawBone(new Vector3(index * spacing, height - 0.5f, 1f * spacing), Quaternion.Euler(-90f, speed * Time.time, 0f), 1f, 1f, colors[index]);
        UltiDraw.DrawWiredBone(new Vector3(index * spacing, height - 0.5f, 2f * spacing), Quaternion.Euler(-90f, speed * Time.time, 0f), 1f, 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireCylinder(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]);
        UltiDraw.DrawCylinder(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]);
        UltiDraw.DrawWiredCylinder(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWirePyramid(new Vector3(index * spacing, height - 0.5f, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, 1f, colors[index]);
        UltiDraw.DrawPyramid(new Vector3(index * spacing, height - 0.5f, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, 1f, colors[index]);
        UltiDraw.DrawWiredPyramid(new Vector3(index * spacing, height - 0.5f, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireCone(new Vector3(index * spacing, height - 0.5f, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.75f, 1f, colors[index]);
        UltiDraw.DrawCone(new Vector3(index * spacing, height - 0.5f, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.75f, 1f, colors[index]);
        UltiDraw.DrawWiredCone(new Vector3(index * spacing, height - 0.5f, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.75f, 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireCuboid(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), new Vector3(0.5f, 1f, 0.5f), colors[index]);
        UltiDraw.DrawCuboid(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), new Vector3(0.5f, 1f, 0.5f), colors[index]);
        UltiDraw.DrawWiredCuboid(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), new Vector3(0.5f, 1f, 0.5f), colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.DrawWireEllipsoid(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]);
        UltiDraw.DrawEllipsoid(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]);
        UltiDraw.DrawWiredEllipsoid(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index], UltiDraw.White);

        index += 1;

        UltiDraw.End();
    }
 void OnRenderObject()
 {
     UltiDraw.Begin();
     UltiDraw.DrawBone(transform.position, Quaternion.LookRotation((transform.localPosition - transform.parent.localPosition).normalized), 0.5f, (transform.position - transform.parent.position).magnitude, UltiDraw.Purple.Transparent(0.5f));
     UltiDraw.End();
 }
Пример #12
0
 void OnDrawGizmos()
 {
     UltiDraw.Begin();
     UltiDraw.DrawBone(transform.position, Quaternion.LookRotation(-(transform.localPosition).normalized), 0.5f, (transform.position - transform.parent.position).magnitude, UltiDraw.IndianRed);
     UltiDraw.End();
 }
 void OnRenderObject()
 {
     UltiDraw.Begin();
     UltiDraw.DrawBone(transform.position, Quaternion.LookRotation(transform.position - parentJoint.position).normalized, 0.5f, , UltiDraw.Purple.Transparent(0.5f));
     UltiDraw.End();
 }
Пример #14
0
    public void Draw()
    {
        UltiDraw.Begin();
        if (DrawRoot)
        {
            UltiDraw.DrawCube(GetRoot().position, GetRoot().rotation, 0.1f, UltiDraw.Black);
            UltiDraw.DrawTranslateGizmo(GetRoot().position, GetRoot().rotation, 0.1f);
        }

        if (DrawSkeleton)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                if (bone.GetParent() != null)
                {
                    UltiDraw.DrawBone(
                        bone.GetParent().Transform.position,
                        Quaternion.FromToRotation(bone.GetParent().Transform.forward, bone.Transform.position - bone.GetParent().Transform.position) * bone.GetParent().Transform.rotation,
                        12.5f * BoneSize * bone.GetLength(), bone.GetLength(),
                        bone.Color == UltiDraw.None ? BoneColor : bone.Color
                        );
                }
                UltiDraw.DrawSphere(
                    bone.Transform.position,
                    Quaternion.identity,
                    5f / 8f * BoneSize,
                    JointColor
                    );
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            foreach (Bone bone in GetRootBones())
            {
                recursion(bone);
            }
        }

        if (DrawVelocities)
        {
            for (int i = 0; i < Bones.Length; i++)
            {
                UltiDraw.DrawArrow(
                    Bones[i].Transform.position,
                    Bones[i].Transform.position + Bones[i].Velocity,
                    0.75f,
                    0.0075f,
                    0.05f,
                    UltiDraw.DarkGreen.Opacity(0.5f)
                    );
            }
        }

        if (DrawTransforms)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                UltiDraw.DrawTranslateGizmo(bone.Transform.position, bone.Transform.rotation, 0.05f);
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            foreach (Bone bone in GetRootBones())
            {
                recursion(bone);
            }
        }
        UltiDraw.End();

        if (DrawSketch)
        {
            Sketch(GetBoneTransformations(), BoneColor);
        }

        if (DrawHistory)
        {
            if (DrawSkeleton)
            {
                int step = Mathf.Max(Sampling, 1);
                for (int i = 0; i < History.Count; i += step)
                {
                    Sketch(History[i].Transformations, BoneColor.Darken(1f - (float)i / (float)History.Count));
                }
            }
            if (DrawVelocities)
            {
                float     max       = 0f;
                float[][] functions = new float[History.Count][];
                for (int i = 0; i < History.Count; i++)
                {
                    functions[i] = new float[Bones.Length];
                    for (int j = 0; j < Bones.Length; j++)
                    {
                        functions[i][j] = History[i].Velocities[j].magnitude;
                        max             = Mathf.Max(max, functions[i][j]);
                    }
                }
                UltiDraw.Begin();
                UltiDraw.PlotFunctions(new Vector2(0.5f, 0.05f), new Vector2(0.9f, 0.1f), functions, UltiDraw.Dimension.Y, yMin: 0f, yMax: max, thickness: 0.0025f);
                UltiDraw.End();
            }
        }
    }