[SOLVED] Get angle between two entities

Normalizes scales everything to be between 0-1.

In that case I think you need first to get the vector between the two entities and then get the angle between the forward vector of the enemy (to have a point of reference for the field of view) and that new vector.

Something like this:

var enemyPos = this.entity.getPosition();
var playerPos = this.player.getPosition();

var targetDir = new pc.Vec3().copy(enemyPos);
targetDir.sub(playerPos).normalize();

var dot = targetDir.dot(this.entity.forward);
var angleInRadians = Math.acos(dot);
var angleToPlayer = angleInRadians * pc.math.RAD_TO_DEG;

if (angleToPlayer >= -45 && angleToPlayer <= 45){
   console.log('inside field of view!');
}

Not tested, but I think something like this may work here.