public RightAnglesControllNode(RightAnglesControllNode node)
 {
     this.forwardPos = node.forwardPos;
     this.backPos    = node.backPos;
     this.turnOrg    = node.turnOrg;
     this.turnSign   = node.turnSign;
 }
        public static List <RightAnglesControllNode> GenControllNodeList(List <Vector3> pathPosList, float turnOrgOffset)
        {
            List <RightAnglesControllNode> ctrList = new List <RightAnglesControllNode>();
            int posLen = pathPosList.Count;

            if (posLen < 2)
            {
                return(ctrList);
            }

            for (int i = 1; i < posLen - 1; i++)
            {
                //前点
                var forwardDir = (pathPosList[i + 1] - pathPosList[i]).normalized;
                var forwardPos = pathPosList[i] + forwardDir * turnOrgOffset;
#if UNITY_EDITOR
                var forwardGo = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                forwardGo.transform.position = forwardPos + new Vector3(0, 8, 0);
                forwardGo.name = string.Format("ctr_forward_{0}", i);
#endif
                //后点
                var backDir = (pathPosList[i] - pathPosList[i - 1]).normalized;
                var backPos = pathPosList[i] - backDir * turnOrgOffset;
#if UNITY_EDITOR
                var backGo = GameObject.CreatePrimitive(PrimitiveType.Capsule);
                backGo.transform.position = backPos + new Vector3(0, 8, 0);
                backGo.name = string.Format("ctr_back_{0}", i);
#endif
                //旋转原点
                var   cross    = Vector3.Cross(forwardDir, backDir);
                short turnSign = 1;
                if (cross.y > 0)
                {
                    turnSign = -1;
                }
                var turnOrgDir = Quaternion.Euler(0, UFrame.Const.RightAngles * turnSign, 0) * backDir;
                var turnOrgPos = backPos + turnOrgDir * turnOrgOffset;
#if UNITY_EDITOR
                var turnOrgGo = GameObject.CreatePrimitive(PrimitiveType.Cube);
                turnOrgGo.transform.position = turnOrgPos + new Vector3(0, 8, 0);
                turnOrgGo.name = string.Format("ctr_turnOrg{0}", i);
#endif
                var ctr = new RightAnglesControllNode();
                ctr.forwardPos = forwardPos;
                ctr.backPos    = backPos;
                ctr.turnOrg    = turnOrgPos;
                ctr.turnSign   = turnSign;
                ctrList.Add(ctr);

                ////旋转点
                //var ctrForward = backNode - ctrNode;
                //float turnAngle = 30f;
                //turnSignList[idxCtr - 1] = 1;
                //if (cross.y > 0)
                //{
                //    turnAngle = -turnAngle;
                //    turnSignList[idxCtr - 1] = -1;
                //}
                //var turnDir = Quaternion.Euler(0, turnAngle, 0) * ctrForward;
                //var turnNode = ctrNode + turnDir;
                //var turnGo = GameObject.CreatePrimitive(PrimitiveType.Cube);
                //turnGo.transform.position = turnNode + new Vector3(0, 8, 0);
                //turnGo.name = string.Format("turn_{0}", i);
            }

            return(ctrList);
        }