예제 #1
0
        // Update is called once per frame

        Vector3 Calpath(int i)
        {
            if (GlobalData.IsFinish() == true)
            {
                Vector3 framepos = GlobalData.frameset[0]["hip"].GetPosition(i);
                Vector3 newpos   = framepos + (framepos - mspl.drawpoint[i]);
            }
            return(Vector3.zero);
            //  Debug.LogError(this.transform.gameObject.name);
        }
예제 #2
0
        void FixedUpdate()
        {
            if (GlobalData.IsFinish())
            {
                frampos = GlobalData.frameset[0]["hip"].GetPosition(Findcurrentframekey()) * GlobalData.m_scale;

                if (this.name == "hip")
                {
                    //frampos = trans.position;
                    offsetx = (-1 * frampos.x) - mspl.drawpoint[Findcurrentframekey()].x;
                    offsety = frampos.y - mspl.drawpoint[Findcurrentframekey()].y;
                    offsetz = frampos.z - mspl.drawpoint[Findcurrentframekey()].z;
                    offset  = new Vector3(offsetx, offsety, offsetz);
                    GlobalData.PosOffset = offset;
                }
                else
                {
                    offset = GlobalData.PosOffset;
                }
                if (this.name == "lButtock")
                {
                    rotateoffset = Vector3.Angle(mspl.origtangpoint[Findcurrentframekey()], mspl.tangpoint[Findcurrentframekey()]);
                    Vector3 crossD = Vector3.Cross(mspl.origtangpoint[Findcurrentframekey()], mspl.tangpoint[Findcurrentframekey()]);
                    float   dir    = Vector3.Dot(crossD, Vector3.up);
                    rotateoffset *= dir;
                    Debug.DrawLine(mspl.drawpoint[Findcurrentframekey()], mspl.drawpoint[Findcurrentframekey()] + mspl.tangpoint[Findcurrentframekey()], Color.red);
                    Debug.DrawLine(mspl.drawpoint[Findcurrentframekey()], mspl.drawpoint[Findcurrentframekey()] + mspl.origtangpoint[Findcurrentframekey()], Color.blue);
                    GlobalData.RotOffset = rotateoffset;
                    //  Debug.LogWarning(rotateoffset);
                }
            }
            if (openInterpolation)
            {
                // if (count % 4 == 0)
                // {

                lastPos = trans.position;
                lastRot = trans.rotation;
                //count = 0;
                //}
                count++;
                t = (float)count / 12.0f;
                this.transform.position = Vector3.Lerp(this.transform.position, lastPos, 0.6f + t) - offset;
                this.transform.rotation = Quaternion.Lerp(this.transform.rotation, lastRot, 0.6f + t);
                if (this.name == "lButtock")
                {
                    this.transform.parent.transform.rotation = Quaternion.Euler(new Vector3(0, rotateoffset, 0));
                }
            }
            else
            {
                this.transform.position = trans.position - new Vector3(2, 0, 0);
                this.transform.rotation = trans.rotation;
            }
        }
 // Update is called once per frame
 void FixedUpdate()
 {
     if (!GlobalData.IsFinish())
     {
         isInit = false;
     }
     if (GlobalData.IsFinish() && !isInit)
     {
         FillCps();
     }
 }
예제 #4
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (trans == null && GlobalData.IsFinish())
     {
         trans = GameObject.FindGameObjectWithTag("sphere").GetComponent <Transform>();
         flag  = true;
     }
     if (flag)
     {
         this.transform.position = Vector3.Lerp(this.transform.position, trans.position * 0.2f - GlobalData.PosOffset * 0.2f, 0.5f) - new Vector3(1, 0, 0);
         this.transform.rotation = Quaternion.Euler(new Vector3(0, GlobalData.RotOffset, 0));
     }
 }