# How to Ease a VectorCurve in C++ given 3 points ?

**URL:** <https://forums.unrealengine.com/t/how-to-ease-a-vectorcurve-in-c-given-3-points/682846>\
**Category:** C++\
**Tags:** fvector, unreal-engine, question\
**Created:** [November 2, 2022, 9:09pm UTC](https://forums.unrealengine.com/t/how-to-ease-a-vectorcurve-in-c-given-3-points/682846 "2022-11-02T21:09:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FedericoRasi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FedericoRasi](https://forums.unrealengine.com/u/FedericoRasi)\
**Post date:** [November 2, 2022, 9:09pm UTC](https://forums.unrealengine.com/t/how-to-ease-a-vectorcurve-in-c-given-3-points/682846/1 "2022-11-02T21:09:34Z")

</div>

I have a FInterpCurveVector with 3 points (Start Location, Middle Location, End Location).  
Every tick I use the Eval function to get the point on the curve to move a projectile on a curved trajectory but now it moves only in a triangle pattern.  
How can I apply some type of easing to the curve?  
This is what I have now:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/1/80183609dfa7dfce97934e559df9aab57b6ae23e.png)  
This is what I’m trying to achieve:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/8/138239a0dc44d73c55d41362526e6d4d25f72486.png)

this is the code for now

```auto
void AProjectile::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
    lifeTime += DeltaTime;
    if (bCurvedProjectile) {
        FVector newLocation = bCurve.Eval(lifeTime, newLocation);
        SetActorLocation(newLocation);
    }
}

void AProjectile::CreateCurve(FVector vTargetLocation, FVector vMediumLocation, FVector vStartLocation) {
    bCurvedProjectile = true;
    ProjectileMovementComponent->Velocity = FVector::ZeroVector;

    bCurve.AddPoint(0, vStartLocation);
    bCurve.AddPoint(1, vMediumLocation);
    bCurve.AddPoint(2, vTargetLocation);

}

```

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [November 2, 2022, 10:31pm UTC](https://forums.unrealengine.com/t/how-to-ease-a-vectorcurve-in-c-given-3-points/682846/2 "2022-11-02T22:31:36Z")

</div>

Actually hitting the middle point is harder. Sweeping towards the target, when starting out going towards the middle point, is simpler – you can for example use a cubic curve for this.

> **[FMath::CubicInterp](https://docs.unrealengine.com/4.26/en-US/API/Runtime/Core/Math/FMath/CubicInterp/1/)**
>
> Performs a cubic interpolation

You have three points, so you calculate the two tangents as `p2-p1` and `p2-p3`.
