private TrackCurveNode AddNode(Vector3 position, TrackCurveNode.NodeType type)
		{
			GameObject node = GameObject.CreatePrimitive(PrimitiveType.Sphere);
			node.transform.name = "BezierNode";
			node.layer = 900;
			node.transform.transform.position = position;
			var n = node.AddComponent< TrackCurveNode>();
			n.TrackSegmentModify = _segmentModify;
			n.Curve = _cubicBezier;
			n.NodePoint = type;
			return n;
		}
		public TrackNodeCurve (CubicBezier cubicBezier, TrackSegmentModify segmentModify,bool beginning)
		{
			this._cubicBezier = cubicBezier;
			this._segmentModify = segmentModify;

			if(!beginning)
				P0 = AddNode ( _segmentModify.TrackSegment.transform.TransformPoint (_cubicBezier.p0),TrackCurveNode.NodeType.PO);
			
			P1 = AddNode (_segmentModify.TrackSegment.transform.TransformPoint (_cubicBezier.p1),TrackCurveNode.NodeType.P1);
			P2 = AddNode (_segmentModify.TrackSegment.transform.TransformPoint (_cubicBezier.p2),TrackCurveNode.NodeType.P2);
			P3 = AddNode (_segmentModify.TrackSegment.transform.TransformPoint (_cubicBezier.p3),TrackCurveNode.NodeType.P3);

		}
        public TrackNodeCurve(CubicBezier cubicBezier, TrackSegmentModify segmentModify, bool beginning)
        {
            this._cubicBezier   = cubicBezier;
            this._segmentModify = segmentModify;

            if (!beginning)
            {
                P0 = AddNode(_segmentModify.TrackSegment.transform.TransformPoint(_cubicBezier.p0), TrackCurveNode.NodeType.PO);
            }

            P1 = AddNode(_segmentModify.TrackSegment.transform.TransformPoint(_cubicBezier.p1), TrackCurveNode.NodeType.P1);
            P2 = AddNode(_segmentModify.TrackSegment.transform.TransformPoint(_cubicBezier.p2), TrackCurveNode.NodeType.P2);
            P3 = AddNode(_segmentModify.TrackSegment.transform.TransformPoint(_cubicBezier.p3), TrackCurveNode.NodeType.P3);
        }