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

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:


This is what I’m trying to achieve:

this is the code for now

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);

}

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.

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

1 Like