Is it possible to get the horizontal dot product between the component of an actor (camera) and the target?

I’ve been spending the past few days on my targeting system and as far as I know I’ve only got one bug remaining. When the player is walking around, the camera is in a “free” mode where it isn’t locked to the player’s rotation. Once they hit the “combat” button the camera zooms in and the character’s rotation snaps to be the rotation of the camera.

When in combat mode the player is constantly scanning for targets based on FOV, range, and LOS. The problem comes in when combat mode is initiated. Before scanning repeatedly there’s one initial scan that’s meant to target whatever the camera is pointing at. This is where my problem comes in. Normally I take the dot product between the player and the potential targets because the player is facing the direction of the camera at all times in combat mode. But combat mode can be initiated when the camera is pointing somewhere other than straight forward. So I need that initial scan to be based on where the camera is pointing, not where the actor is facing. I tried adding a delay to the whole thing so that the game starts the initial scan at a time where the camera and player are guaranteed to be facing the same way but that is not an adequate workaround as I’d like the targeting to be as instant as possible.

So, can I somehow get the angle between the direction the camera is facing and the target? So that when I press the combat button the first targeting scan is done on what the camera is pointing at?

Wouldn’t it be easier to just Camera → GetForwardVector and then set the Character’s horizontal rotation to be the same?

Answer here:
https://www.reddit.com/r/unrealengine/comments/9kxmnu/is_it_possible_to_get_the_horizontal_dot_product/