bool IsBFacingA(vec2 A, vec2 B, float bRotation, float tolerance)
{
var BtoA = A - B;
var dir = normalize(BtoA);
var orientation = vec2(sin(bRotation), cos(bRotation));
var facing = dot(dir, orientation);
return facing >= tolerance;
}
bool IsBFacingTheSameDirectionAsA(float aRotation, float bRotation, float tolerance)
{
var aOrientation = vec2(sin(aRotation), cos(aRotation));
var bOrientation = vec2(sin(bRotation), cos(bRotation));
var facing = dot(aOrientation , bOrientation );
return facing >= tolerance;
}