Example #1
0
 public void CmdChangTran(float[] _pxArr, float[] _pyArr, float[] _pzArr, float[] _exArr, float[] _eyArr, float[] _ezArr)
 {
     if (transSyncList != null)
     {
         for (int _itemIndex = 0; _itemIndex < _pxArr.Length; _itemIndex++)
         {
             if (transSyncList.Count > _itemIndex)
             {
                 transTemp = transSyncList[_itemIndex];
                 SetTrans(_pxArr[_itemIndex], _pyArr[_itemIndex], _pzArr[_itemIndex], _exArr[_itemIndex], _eyArr[_itemIndex], _ezArr[_itemIndex], out transTemp);
                 transSyncList[_itemIndex] = transTemp;
                 transSyncList.Dirty(_itemIndex);
             }
             else if (transSyncList.Count == _itemIndex)
             {
                 SetTrans(_pxArr[_itemIndex], _pyArr[_itemIndex], _pzArr[_itemIndex], _exArr[_itemIndex], _eyArr[_itemIndex], _ezArr[_itemIndex], out transTemp);
                 transSyncList.Add(transTemp);
             }
             else
             {
                 for (int i = 0; i < _itemIndex - transSyncList.Count; i++)
                 {
                     transSyncList.Add(transTemp);
                 }
                 SetTrans(_pxArr[_itemIndex], _pyArr[_itemIndex], _pzArr[_itemIndex], _exArr[_itemIndex], _eyArr[_itemIndex], _ezArr[_itemIndex], out transTemp);
                 transSyncList.Add(transTemp);
             }
         }
     }
 }
Example #2
0
 /// <summary>
 /// 插值平滑位置和旋转
 /// </summary>
 private void LerpTransfrom()
 {
     for (int i = 0; i < proxyList.Count; i++)
     {
         lerpTimes[i] -= LerpStep;
         if (lerpTimes[i] <= 0)
         {
             continue;
         }
         else
         {
             if (transSyncList.Count > i)
             {
                 currSync           = transSyncList[i];
                 currProxy          = proxyList[i];
                 oldTransItem       = oldTrans[i];
                 t                  = (float)(syncRateFrames - lerpTimes[i]) / (float)syncRateFrames;
                 currProxy.position = Vector3.Lerp(oldTransItem.position, currSync.position, t);
                 currProxy.rotation = Quaternion.Lerp(Quaternion.Euler(oldTransItem.euler), Quaternion.Euler(currSync.euler), t);
             }
         }
     }
 }
Example #3
0
 private void Start()
 {
     transSyncList.Callback = TransChanged;
     transTemp = new TransSimple();
     InitArr();
 }
Example #4
0
 private void SetTrans(float _px, float _py, float _pz, float _ex, float _ey, float _ez, out TransSimple _transTemp)
 {
     _transTemp.position.x = _px;
     _transTemp.position.y = _py;
     _transTemp.position.z = _pz;
     _transTemp.euler.x    = _ex;
     _transTemp.euler.y    = _ey;
     _transTemp.euler.z    = _ez;
 }