public void updateSegmentAndChildren() { updateSegment(); //update its children if (child) { child.updateSegmentAndChildren(); } }
// 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(); } }