示例#1
0
        // Token: 0x06002750 RID: 10064 RVA: 0x000B6344 File Offset: 0x000B4544
        public static void SolveInward(Core.Chain chain)
        {
            int count = chain.joints.Count;

            chain.joints[count - 1].pos = Vector3.Lerp(chain.GetVirtualEE(), chain.GetIKtarget(), chain.weight);
            for (int i = count - 2; i >= 0; i--)
            {
                Vector3 pos    = chain.joints[i + 1].pos;
                Vector3 vector = chain.joints[i].pos - pos;
                vector.Normalize();
                vector *= Vector3.Distance(chain.joints[i + 1].joint.position, chain.joints[i].joint.position);
                chain.joints[i].pos = pos + vector;
            }
        }
示例#2
0
        /// <summary>
        /// Find the virtual new solved position of joints in the chain inward
        /// </summary>
        /// <param name="chain"></param>
        public static void SolveInward(Core.Chain chain)
        {
            int c = chain.Joints.Count;

            //Use Weight first
            chain.Joints[c - 1].pos = Vector3.Lerp(chain.GetVirtualEE(), chain.GetIKTarget(), chain.Weight);

            //find the joint on the chain's virtual line
            for (int i = c - 2; i >= 0; i--)
            {
                Vector3 _p = chain.Joints[i + 1].pos;   //point
                Vector3 _d = chain.Joints[i].pos - _p;  //direction

                _d.Normalize();
                _d *= Vector3.Distance(chain.Joints[i + 1].joint.position, chain.Joints[i].joint.position);   //all points in a direction along a length

                chain.Joints[i].pos = _p + _d;
            }
        }