Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disable the Update of the CurvySpline
#4
I Used my own CustomSplineController


here is the code:

Code:
    private CurvySpline _curvySpline = default;
    private float _speed = 0.0120f;

    public void CustomUpdate()
    {
       _currentPercent = (_currentPercent + (_speed * Time.deltaTime));
       if (_currentPercent >= 1)
       {
           _currentPercent %= 1;
       }
       _toMove.position = _curvySpline.InterpolateFast(_currentPercent);
       _toMove.rotation = _curvySpline.GetOrientationFast(_currentPercent);
   }

I have 200 of this controllers. Each of them are called at each update by a script who contain an array of the 200 players.

I have profiled 200 of your SplineController, and my CustomSplineController, the result (in build):
200 of your SplineController use 50% of the CPU, and 14.5ms
Then I have tryed with my custom script:
200 of my CustomSplineController use 9,4% CPU, for 1.51ms

I think you could have in your plugin a custom optimised script like mine.

Then only problem for me: I use InterpolateFast (or Interpolate), and the speed of my object depends of the lenght of the segment there are in. How could I change that ?
I have also tryed that: 
Code:
_toMove.position = _curvySpline.MoveByLengthFast(ref _currentPercent, ref direction, _speed * Time.deltaTime, CurvyClamping.Loop);
(or other move function, but it always the same)

Thanks you again for everything.
Reply


Messages In This Thread
RE: Disable the Update of the CurvySpline - by UsernameHed - 05-21-2019, 02:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Disable rebuild of meshes in dynamic mode Zilk1 1 8 10-04-2023, 09:50 AM
Last Post: _Aka_
  Disable Generator Rasterized Objects SAMYTHEBIGJUICY 3 5 09-01-2023, 03:38 PM
Last Post: _Aka_
  I have a question about curvySpline haifeng.huang 12 32 07-14-2023, 09:34 AM
Last Post: _Aka_
  "Deadloop in CurvySPline.Refresh" spam Valkymaera 3 11 05-30-2023, 10:56 AM
Last Post: _Aka_

Forum Jump: