PointList() public static method

获取曲线上面的所有点
public static PointList ( Vector3 path, int pointSize ) : Vector3[]
path Vector3 需要穿过的点列表
pointSize int 两个点之间的节点数量
return Vector3[]
Example #1
0
    /// <summary>
    /// 绘制导线
    /// </summary>
    public void DrawLine()
    {
        Vector3 s      = m_line.StartLineLeap.Link != null ? m_line.StartLineLeap.Link.transform.position : m_line.StartLineLeap.transform.position;
        Vector3 e      = m_line.EndLineLeap.Link != null ? m_line.EndLineLeap.Link.transform.position : m_line.EndLineLeap.transform.position;
        bool    change = CheckCtrlChange(s, m_MidCtrl.transform.position, e);

        if (m_lpoint.Count > 0)
        {
            if (change == true)
            {
                Vector3[] resultList = PointController.PointList(pathList, pointnum);
                for (int i = 0; i < resultList.Length; i++)
                {
                    if (i == 0 && m_line.StartLineLeap.Link != null)
                    {
                        m_lpoint[0] = m_line.StartLineLeap.Link.transform.position;
                    }
                    else if (i == 0 && m_line.StartLineLeap.Link == null)
                    {
                        m_lpoint[0] = m_line.StartLineLeap.transform.position;
                    }
                    else
                    {
                        m_lpoint[i] = resultList[i];
                    }
                }
                if (m_line.EndLineLeap.Link != null)
                {
                    m_lpoint[resultList.Length - 1] = m_line.EndLineLeap.Link.transform.position;
                }
                else
                {
                    m_lpoint[resultList.Length - 1] = m_line.EndLineLeap.transform.position;
                }
                SetColloderPosition();
            }
        }
        else
        {
            Vector3[] resultList = PointController.PointList(pathList, pointnum);
            for (int i = 0; i < resultList.Length; i++)
            {
                m_lpoint.Add(resultList[i]);
            }
            InitCollider();
            m_fLineMiniDistance = U3DUtil.GetVectorListDistance(m_lpoint);
        }
        //if (CheckMiniDistance())
        //{
        //    return;
        //}
        //循环100遍来绘制贝塞尔曲线每个线段
        for (int i = 0; i < m_lpoint.Count; i++)
        {
            Vector3 vec = m_lpoint[i];
            //把每条线段绘制出来 完成白塞尔曲线的绘制
            Line.SetPosition(i, vec);
            Line.SetWidth(fwidth, fwidth);
        }
    }
Example #2
0
 public List <Vector3> CreateBZ()
 {
     if (mBuffsPoint.Count > 1)
     {
         Vector3[] tempVes = new Vector3[mBuffsPoint.Count];
         for (int i = 0; i < mBuffsPoint.Count; i++)
         {
             tempVes[i] = mBuffsPoint[i].pos;
         }
         Vector3[] resultList = PointController.PointList(tempVes, mSize);
         return(new List <Vector3>(resultList));
     }
     return(null);
 }
Example #3
0
 static public int PointList_s(IntPtr l)
 {
     try {
         UnityEngine.Vector3[] a1;
         checkArray(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         var ret = PointController.PointList(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }