How could I take a target and a point and figure out if that point is facing behind target, I currently posses the weakest grasp of understanding of mathematics or CFrames e.g
Sorry for my briefness.
Define a direction that’s “front”. Take a target with x position of 10. In this example 10 and greater is in front. Just check if the parts position is less than 10.
Rotating object A caused some interesting results https://gyazo.com/d6babdf77c1cbef7c53e67a23a697d29
If object a is rotated enough it would be considered behind object b even though it is clearly not (the motor is used to show what direction object b is facing)
Found my own solution, marking this as one encase anyone else has an issue. While my knowledge is limited, I am aware of how to find a point X studs infront of behind something. Simply figure out which one the enemy is closer too in order to figure out if they are behind or not.
local function IsBehind(Target,AttackerLocation)
local point1,point2 = (Target.CFrame + Target.CFrame.LookVector),(Target.CFrame + Target.CFrame.LookVector*-1)
local mag1,mag2 = (point1.Position-AttackerLocation).Magnitude,(point2.Position-AttackerLocation).Magnitude
return not (mag1 <= mag2)
end