03-07-2018, 11:33 AM
Hi,
I'm still testing Curvy and here is another issue:
I wish to determine on my own the direction that should take my controller at an intersection. Basically, when there is a connection, if the next spline can be continued at right or left, I look at the tangentes to determine the best way from my terms. Well so I did that but even if I set my controller a new direction at -1, it keep to be at 1. I set some log on Curvy's script to find out where my direction could be erase, but I didn't found the issue.
Here he's the simple code where I assign the direction:
I'm still testing Curvy and here is another issue:
I wish to determine on my own the direction that should take my controller at an intersection. Basically, when there is a connection, if the next spline can be continued at right or left, I look at the tangentes to determine the best way from my terms. Well so I did that but even if I set my controller a new direction at -1, it keep to be at 1. I set some log on Curvy's script to find out where my direction could be erase, but I didn't found the issue.
Here he's the simple code where I assign the direction:
Code:
// Find new spline
int randomIndex = Random.Range(0, valideControlPoints.Count);
CurvySplineSegment controlPoint = valideControlPoints[randomIndex];
if (controlPoint != e.ControlPoint)
{
e.Follow(controlPoint); // Follow the new spline
// Set the controller to use the new spline
Controller.Spline = controlPoint.Spline;
Controller.RelativePosition = e.TF;
Controller.Direction = FindBestDirection(controlPoint, e.Spline, e.TF, Controller.Direction);
}