05-09-2019, 02:51 PM
Hello 
I have a little situation when I want to do a custom transition between 2 offset with curvy.
My goal is:
I have somes keys on a road, with a SplineController static on the keys, with different offset radius & angle.
Then I have a player, with a SplineController who follow the road. I want to lerp the offSet radius/angle of the player depending on the key before and after.
So Every frame, I'm doing my calculation, and here the result:
Basicly, I do:
The problem is durring the lerp, the car is going up and down in a circle, and it is logic from my code and yours...
But how can I do an offset lerp without this weird behavior ?
Thanks

I have a little situation when I want to do a custom transition between 2 offset with curvy.
My goal is:
I have somes keys on a road, with a SplineController static on the keys, with different offset radius & angle.
Then I have a player, with a SplineController who follow the road. I want to lerp the offSet radius/angle of the player depending on the key before and after.
So Every frame, I'm doing my calculation, and here the result:
Basicly, I do:
Code:
_splineController.OffsetRadius = Mathf.Lerp(prevRadius, nextRadius, percent);
_splineController.OffsetAngle = Mathf.Lerp(prevAngle, nextAngle, percent);
prevRadius & prevAngle: the value of the previous gost Spline Controller (white car)
same with next for the next gost
The problem is durring the lerp, the car is going up and down in a circle, and it is logic from my code and yours...
But how can I do an offset lerp without this weird behavior ?
Thanks
