Example #1
0
    public void drag(Vector3 target)
    {
        pointAt(target);
        transform.position = target - transform.forward * length;

        if (parent)
        {
            parent.drag(transform.position);
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (isDragging)
        {
            lastSegment.drag(target.position);
        }
        else if (isReaching)
        {
            //call reach on the last
            lastSegment.reach(target.position);

            //and forward update on the first
            //we needed to maintain that first segment original position
            //which is the position of the IK system itself
            firstSegment.transform.position = transform.position;
            firstSegment.updateSegmentAndChildren();
        }
    }