Beispiel #1
0
        void InitSpline()
        {
            mSpline.Granularity = GetGranularity();

            mSpline.Clear();

            for (int i = 0; i < LifeFrame; i++)
            {
                mSpline.AddControlPoint(CurHeadPos, PointStart.position - PointEnd.position);
            }
        }
Beispiel #2
0
        private void LateUpdate()
        {
            if (!_inited)
            {
                return;
            }

            if (CapFps)
            {
                _time += Time.deltaTime;
                if (_time < 1f / 90)
                {
                    return;
                }

                _time = 0;
            }

            _frameNum++;

            if (_frameNum == _skipFirstFrames + 1)
            {
                _vertexPool.SetMeshObjectActive(true);

                _spline.Granularity = Granularity;
                _spline.Clear();
                for (int i = 0; i < TrailLength; i++)
                {
                    _spline.AddControlPoint(CurHeadPos, PointStart.position - PointEnd.position);
                }
                _snapshotList.Clear();
                _snapshotList.Add(new Element(PointStart.position, PointEnd.position));
                _snapshotList.Add(new Element(PointStart.position, PointEnd.position));
            }
            else if (_frameNum < _skipFirstFrames + 1)
            {
                return;
            }

            UpdateHeadElem();
            RecordCurElem();
            RefreshSpline();
            UpdateVertex();
            _vertexPool.LateUpdate();
        }
Beispiel #3
0
        /// <summary>
        /// Add a control point to the end of the spline.
        /// </summary>
        /// <param name="controlPoint"></param>
        /// <returns></returns>
        public Mesh AddControlPoint(Vector3 controlPoint)
        {
            SplineModificationInfo info = Spline.AddControlPoint(controlPoint);

            return(UpdateMesh(info));
        }