So I’m making an FPS and I’ve got enemy spawn points in my level that use dot product to determine whether they’re in front of or behind the player (as well as a bunch of other voodoo to test whether they’re being rendered or have been rendered recently). The problem I’m having right now is that the spawn points directly to the side of the player, while not technically behind them, and not rendered, are not viable from a gameplay standpoint unless I want enemies to spawn in, flank the player, and subsequently stomp the snot out of them.
Let you in on a little secret, I don’t want that, but that’s what I’m currently getting.
Is there any math kung fu I can layer over my current ‘in front of’ script to weed out these side points? Here’s my current setup:
Yes, replace get actor forward vector with get actor right vector, and you can do it with left and right as well. If you would rather work in degrees, you can take the inverse cosine (acosd), and that will tell you the relative angle around the forward vector, or right vector.