Hi, I’m new in C++, I’m trying to code a function to get the distance between to actors like this:
float UMyBPFunctionLibrary::Distance(AActor* Actor_A, AActor* Actor_B)
FVector Actor_ALocation = Actor_A->GetActorLocation();
FVector Actor_BLocation = Actor_B->GetActorLocation();
return sqrt((Actor_BLocation.X - Actor_ALocation.X) ^ 2 + (Actor_BLocation.Y - Actor_ALocation.Y) ^ 2 + (Actor_BLocation.Z - Actor_ALocation.Z) ^ 2);
What’s wrong with it?