(08-14-2020, 02:17 PM)_Aka_ Wrote: Hi,
Your video is private.
The error happens when the controller updates itself. So my questions are:
1- on what spline that controller is running? Is it the same spline that gets destroyed (dynamicPath)
2- do you confirm that this error happens after you dispose TempPath?
If so, consider destroying the controller at the same time as the spline it runs on. Or if not possible, stop the controller, or set its spline to null or any other spline still alive
after two day dig down, finally found the reason.
well an issue was I did something like this.
Code:
SwitchTo(m_TempPath.dynamicPath, 0f, 0f);
and I did some lazy change to achieve that, I mean "input the ZERO duration."
because of that, following line had divide zero issue.
in SplineController.cs > ComputeTargetPositionAndRotation()
Code:
targetPosition = OptimizedOperators.LerpUnclamped(switchlessPosition, positionOnSwitchToSpline, SwitchProgress);
well, the solution for me was avoid using SwitchTo(), but do as follow when switch_duration == 0.
Code:
base.Stop();
Spline = m_TempPath.dynamicPath;
RelativePosition = float.Epsilon;
Play();
well seem not a complete solution, but it will do.
a little suggestion for author,
perhaps adding a early return cases in "SplineController.cs > ComputeTargetPositionAndRotation()",
e.g.
Code:
if (SwitchDuration <= 0f)
targetPosition = positionOnSwitchToSpline;
else
targetPosition = OptimizedOperators.LerpUnclamped(switchlessPosition, positionOnSwitchToSpline, SwitchProgress);
and I believe you will found the better solution like prevent the Zero duration SwitchTo request on high level.
anyway your call~ thanks for the assist.