10-06-2016, 08:43 PM
Hello,
I am new at Curvy, it seems great tool.
Here is my problem: I have created 4 points spline, and i have implemented my own ship movement controller.
The problem is that when ship passes around some of CP having much turn angle or curvature, ship slows down.
Below my Move ship is given:
void MoveShip()
{
float len = Spline.Length;
Tf += Time.deltaTime * ShipSpeed/len;
if(Tf>1.0f){
Tf = Tf - (int)Tf;
}
Vector3 pos = Spline.Interpolate(Tf);
Ship.transform.position = pos;
Ship.transform.rotation = Spline.GetOrientationFast(Tf);
Vector3 forward = Spline.GetTangent(Tf);
Vector3 up = Spline.GetOrientationUpFast(Tf);
Cam.transform.position = pos - forward*15.0f + up *5.0f;
Cam.transform.LookAt(pos);
}
I am new at Curvy, it seems great tool.
Here is my problem: I have created 4 points spline, and i have implemented my own ship movement controller.
The problem is that when ship passes around some of CP having much turn angle or curvature, ship slows down.
Below my Move ship is given:
void MoveShip()
{
float len = Spline.Length;
Tf += Time.deltaTime * ShipSpeed/len;
if(Tf>1.0f){
Tf = Tf - (int)Tf;
}
Vector3 pos = Spline.Interpolate(Tf);
Ship.transform.position = pos;
Ship.transform.rotation = Spline.GetOrientationFast(Tf);
Vector3 forward = Spline.GetTangent(Tf);
Vector3 up = Spline.GetOrientationUpFast(Tf);
Cam.transform.position = pos - forward*15.0f + up *5.0f;
Cam.transform.LookAt(pos);
}