05-21-2019, 02:45 PM
(This post was last modified: 05-21-2019, 03:01 PM by UsernameHed.)
I Used my own CustomSplineController
here is the code:
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:
(or other move function, but it always the same)
Thanks you again for everything.
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);
Thanks you again for everything.