Hallo liebe Community,
ich habe ein kleines Problem. Und zwar möchte ich eine Berechnung die in C++ gemacht wurde in Blueprints interpretieren.
Folgendes ist der Code:
Code
FVector UCalcFunctionLibrary::LinearTargetPrediction(
const FVector &TargetLocation,
const FVector &StartLocation,
const FVector &TargetVelocity,
const float ProjectileVelocity)
//returns a location at which has to be aimed in order to hit the target
{
FVector ABmag = TargetLocation - StartLocation;
ABmag.Normalize();
FVector vi = TargetVelocity - (FVector::DotProduct(ABmag, TargetVelocity) * ABmag);
//in short:
return StartLocation + vi + ABmag * FMath::Sqrt(ProjectileVelocity * ProjectileVelocity - FMath::Pow((vi.Size()), 2.f));
}
Alles anzeigen
soweit bin ich schon, wahrscheinlich ist das aber auch falsch..