void _LerpPos(int inputNum, Vector3 pos) { var timeStep = Time.deltaTime / inputNum; var timePrev = Time.time - Time.deltaTime; if (LerpType.Spline == _lerpType && (_posLog.Count >= 2)) { var prev = _posLog.Last.Previous.Value; var start = _posLog.Last.Value; for (var i = 1; i < inputNum; ++i) { _newPoints.Add(new Node() { pos = GPUTrailSpline.CatmullRom((float)i / inputNum, prev, start, pos), time = timePrev + timeStep * i }); } } // Linear else { var posPrev = _posLog.Last(); var posStep = (pos - posPrev) / inputNum; for (var i = 1; i < inputNum; ++i) { _newPoints.Add(new Node() { pos = posPrev + posStep * i, time = timePrev + timeStep * i }); } } }
public void OnDrawGizmos() { var stepInv = 1f / step; for (var i = 2; i < _transforms.Count; ++i) { for (var s = 0; s < step; ++s) { var prev = _transforms[i - 2].position; var start = _transforms[i - 1].position; var end = _transforms[i].position; var pos = GPUTrailSpline.CatmullRom(stepInv * s, prev, start, end); var posNext = GPUTrailSpline.CatmullRom(stepInv * (s + 1), prev, start, end); Gizmos.DrawLine(pos, posNext); } } }