So I've made changes to make game, that made it possible to apply damage to different parts of the enemy's body and it changed the way the entire game felt. I imagined it would make the game easier, as not the player can kill an enemy with a single headshot.
However, it's not always easy to land these heads shots. Also, shooting the enemy in their arms would divide the damage applied in 2, while shooting the enemy in the leg would divide the damage applied by 4. Shooting the enemy in the chest, will apply the default amount of damage but, shooting them in the head will multiply the damage by 4; guaranteeing an instant kill. I've even added different pain animations for each body part. Still, I don't know how to implement a system where animations are sensitive to which angle the shot were inflicted. This isn't isn't noticeable most of the time, in the hit of a gun fight. It does get noticeable when it comes to the death an animation (which I haven't change for this very reason). Now the solution to this problem could involve applying more hitboxes to the enemy but, I think that's a cop out; there is something I'm trying to run away from that has been haunting all this time.
How don't know how to let the enemy( or the player) know the angle to anything( or how many rotation degrees on the y axis it would take to turn to a specific object). The end result, is that I don't know how to make the enemy know if the player is in front of them without using the raycast. I know that the solution would involve using the dot product but, I simply don't know to use it and the documentation hasn't help it that regard. I've even looked at GDscript's video on the subject at it just went over my end. Is there a way around this problem? Can anyone help?