Hi. I’m trying to think of a way to check if the NPC is on the left or right side of the Player from Players perspective. This calculation should happen inside the NPC, because this calculation it’s going to affect the NPC itself. The calculation should take place from all camera angles, because the game has a free 3D camera…
“Dot product” seems to give some pretty weird and large numbers which I don’t understand at all… and the number gets smaller the farther you go from the NPC.
Dot product is between two direction vectors, so the forward vector of the camera and the player or the NPC. It will always give something in the range -1 ( 180 degrees to each other ) to 1 ( both facing the same way ). 0 is right angles.
This has nothing to do with camera whatsoever. Not the player’s, and the NPC probably does not even have a camera to start with. Unless you want to check which side of the camera’s fwd something is. But you said NPC and Player.