08-01-2019, 01:16 AM
I am working on a ring menu for our game using Curvy. We are using OnControlPointReached to determine when a control point is - well - reached. However, it appears to be wildly inaccurate, and does not stop at the exact point. We have attempted to also force the position once the point is reached, however it does not appear to work correctly.
In the following GIF, you can see the issue occurring as we move forwards and backwards in the menu.
GIF Of Issue Occuring
The code we are using to move the object looks like this:
The following code is then used to listen for OnControlPointReached, and attempt to force the position:
The event listener is absolutely getting triggered. The values in the debug output above showing the splineControl.Position and inArgs.ControlPoint.TF match perfectly. HOWEVER - if we go to the Position section of the Spline Controller component on the object in question, the Position is NOT the same as what was dumped to the console. If we manually type in the value to the Position section, then it jumps to the correct position.
I am pretty stuck on this and could really use any help I can get. Thank you in advance!
In the following GIF, you can see the issue occurring as we move forwards and backwards in the menu.
GIF Of Issue Occuring
The code we are using to move the object looks like this:
Code:
splineControl.MovementDirection = MovementDirection.Forward;
splineControl.MoveMode = CurvyController.MoveModeEnum.Relative;
splineControl.Speed = 1f;
splineControl.Play();
The following code is then used to listen for OnControlPointReached, and attempt to force the position:
Code:
void ControlPointReached(CurvySplineMoveEventArgs inArgs)
{
if ((inArgs.Sender != splineControl) || (inArgs.Sender == splineControl && inArgs.ControlPoint == LastSplineSegment))
return;
LastSplineSegment = inArgs.ControlPoint;
// Make absolutely sure the Sender is at the desired position. Sometimes they'll jump otherwise.
splineControl.Pause();
splineControl.Position = inArgs.ControlPoint.TF;
splineControl.Refresh();
Debug.Log(splineControl.Position + " / " + inArgs.ControlPoint.TF);
NodeIsMoving = false;
}
The event listener is absolutely getting triggered. The values in the debug output above showing the splineControl.Position and inArgs.ControlPoint.TF match perfectly. HOWEVER - if we go to the Position section of the Spline Controller component on the object in question, the Position is NOT the same as what was dumped to the console. If we manually type in the value to the Position section, then it jumps to the correct position.
I am pretty stuck on this and could really use any help I can get. Thank you in advance!