It would appear a quadratic equation might well be what I need.
I’m currently reading through this:
I know this should be simple, but I’m afraid that I find it so slow to read algebraic formula not in code form.
If I have any success, then I will be sure to post it here!
Also; my previous reply doesn’t seem to have appeared. Does it need moderating?
Edit: Rewritten response to Kamrann.
So, below is my current implementation of your maths, but I appear to be missing something as the projectiles always fall short.
I’m logging the distance and height difference, and they appear to be correct.
float Theta = 30.f; // launch angle
FVector dir = TargetPosition - startPos;
float Sz = dir.Z;// height difference
dir.Z = 0;
float Sx = dir.Size();// distance
float V = (Sx / cos(Theta)) * FMath::Sqrt(Gravity / (2 * (Sx * tan(Theta) - Sz)));
FVector VelocityOutput = FVector(V*cos(Theta), 0, V*sin(Theta));
UE_LOG(LogTemp, Warning, TEXT("Distance = %f"), Sx);
UE_LOG(LogTemp, Warning, TEXT("Height = %f"), Sz);
Am I misinterpreting what you’re saying here?