I’m currently using VInterpTo() when panning my player camera to a certain desired location. VInterpTo() gives a nice smooth transition, however it never actually finishes (or reaches its destination) when the target is moving (like moving back to the standard player view location).
I could solve this by using VLerp(vector A, vector B, float Alpha), but then the transition is linear and not smooth.
Any idea of how I can use get a smoothed transition when zooming back to the player pov?
I ended up just creating an InterpCurveFloat for the alpha value of the VLerp(), which is working quite nicely:
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//Gets a float interp curve that starts slow, then quickens, then slows down again as it reaches the end.
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
static function InterpCurveFloat CreateInterpCurve_Float_SmoothInSmoothOut(float duration)
{
local InterpCurveFloat fCurve;
local InterpCurvePointFloat curvePoint;
//Set the interp method that we'll use on all points.
curvePoint.InterpMode = CIM_Linear;
//Now plot the points.
curvePoint.InVal = 0.00;//Time
curvePoint.OutVal = 0.00;
curvePoint.ArriveTangent = 0.00;
curvePoint.LeaveTangent = 0.00;
fCurve.Points.AddItem(curvePoint);
curvePoint.InVal = duration * 0.25;//Time
curvePoint.OutVal = 0.10;
curvePoint.ArriveTangent = 0.793;
curvePoint.LeaveTangent = 0.793;
fCurve.Points.AddItem(curvePoint);
curvePoint.InVal = duration * 0.75;//Time
curvePoint.OutVal = 0.90;
curvePoint.ArriveTangent = 0.655;
curvePoint.LeaveTangent = 0.655;
fCurve.Points.AddItem(curvePoint);
//End of curve
curvePoint.InVal = duration;//Time
curvePoint.OutVal = 1.00;//Reach the end of the curve.
curvePoint.ArriveTangent = 0.00;
curvePoint.LeaveTangent = 0.00;
fCurve.Points.AddItem(curvePoint);
return fCurve;
}
Then i just eval the curve in the camera while the lerp is active, using the time delta since the lerp started as the alpha value.