I’m trying to check if actors within my TArray are standing within an imaginary cone in front of the player. It seems like the fastest way to do this would be to take the dot product of the player’s forward facing, and the vector from the player to the target. The former is easily done with FVector:DotProduct, but I can’t find a method for the latter- is one built in? I tried the following (as subtracting two locations should yield direction). but it gave me an angle of -1.#IND00, which doesn’t seem right:
(targetList[i]->GetActorLocation() - myActor->GetActorLocation())
Maybe (targetList[i]->GetActorLocation() - myActor->GetActorLocation()) returns 0,0,0 ? Their in the same position?
Hmm, I normalized the subtraction and switched to Fmath::Acos, but it gives the result result. I get -1.#ND00 from every position I test it in, so I’m pretty sure it isn’t returning 0,0,0…