Interpolating between 2 FVectors, so confused

I’m calculating a movement vector, where magnitude is used for the velocity in the frame and the units for direction, using various effects like input, gravity etc (doing it from scratch in Pawn).

I’m stuck on calculating an FVector that is somewhere between 2 existing FVectors. I have used lerp and such in blueprints, but I know those use rotators. So is that the same process in c++? Do I lerp, having to deconstruct the FVectors into FRotators (I believe this uses unit vectors? maybe a conversion to degrees from there?), average the original FVectors lengths and reapply the magnitude to the result of the lerp (assuming it’s a unit vector again)?

Or is there a more direct way to lerp using the FVectors directly?


Im not sure what you’re asking but if you want to lerp between 2 Vectors or 2 Rotators this is the simplest way as i know:

// Lerp Between 2 FVectors
FVector A;
FVector B;
float Alpha = 0.5f;
FVector C = FMath::Lerp(A, B, Alpha);
// To Get the Rotation From a Vector

// Lerp Between 2 FRotators
FRotator A;
FRotator B;
float Alpha = 0.5f;
FRotator C = FMath::Lerp(A, B, Alpha);

// To get the vectors from a rotator

By the way everything is identical to the blueprint names so it should be easy to port your bps to c++.

Excellent, thank you very much for that!

Thanks. :slight_smile: By the way the answer is now unaccepted because of the comment :stuck_out_tongue: