Lerp between two direction vector
Hello i'm trying to create a kind of inertia on my character controller (sliding character, kind of snowboarding).
The thing i have is a direction which is calculated in real time depending the orientation of the player (referenced by the camera, but that doesn't really matter here). And an oldDirection which is stocked when the player does a brutal joystick movement.
In code i'm here :
realDirection = Vector3.Lerp(slideOldDirection, slideDirection, currentTime / timeInertia);
//realDirection = Vector3.SmoothDamp(slideOldDirection, slideDirection, ref velocity, timeInertia);
characterController.Move((realDirection) * slideSpeedFinal * Time.deltaTime);
As you can see i've tried two version one with Lerp and one with SmoothDamp, both does not do what i want :
Lerp : It actually kind of works, but it's linear until i'm close to the end and then the player gain a kind of boost of speed to the new direction when the inertia shall be gone.
SmoothDamp : Actually doing thing i'm not even completely understand ...
So to explain a bit more my code : i'm doing a lerp between the old direction (which was previously stocked) and interpolating to the new direction (the direction the player is actually facing) which provoke a kind of inertia by stocking it into a variable which will set my real direction. Then with the Move i set my direction which i multiply by a speed i'm calculating depending on multiple factor (homemade physic).
I'm not sure i've been super clear on my explanations so if you need something more clear i can try to do better or even give a gif (school project so no NDA).
Greetings !