# How to add a smoothing curve to VLerp()

**URL:** <https://forums.unrealengine.com/t/how-to-add-a-smoothing-curve-to-vlerp/135922>\
**Category:** UDK Programming and UnrealScript\
**Tags:** unreal-engine\
**Created:** [January 4, 2020, 8:40pm UTC](https://forums.unrealengine.com/t/how-to-add-a-smoothing-curve-to-vlerp/135922 "2020-01-04T20:40:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coldscooter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Coldscooter](https://forums.unrealengine.com/u/Coldscooter)\
**Post date:** [January 4, 2020, 8:40pm UTC](https://forums.unrealengine.com/t/how-to-add-a-smoothing-curve-to-vlerp/135922/1 "2020-01-04T20:40:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Coldscooter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Coldscooter](https://forums.unrealengine.com/u/Coldscooter)\
**Post date:** [January 5, 2020, 12:15am UTC](https://forums.unrealengine.com/t/how-to-add-a-smoothing-curve-to-vlerp/135922/2 "2020-01-05T00:15:15Z")

</div>

I ended up just creating an InterpCurveFloat for the alpha value of the VLerp(), which is working quite nicely:

```auto

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//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.
