I’ve attached images of my current dot product code and the lines I’m trying to work out the angle between. I keep trying to remake this or make it work based on tutorials but somehow I just keep making it worse.
I’m trying to work out if the player is over 40 degrees to the right or left of the turret, and I have to use dot product to do this because it’s for an assessment, but the math just isn’t mathing.
This is direction to the player from world origin 0,0,0 and does not account for where the turret is. Instead of player location, do Unit Direction from Turret World Location to Player World Location and feed that into the dot node:
No need to normalise Unit Direction - already normalised as well. Your pic seemed OK at a (very quick) glance, though! In case the above does not produce what it should:
Idea end result is kind of like an angle of attack where the turret can spot the player. If they’re in between 40 degrees left to right in front of it, it should be able to spot them.
Just tried the in range you suggested and it worths perfectly so thanks, you’re a sanity saver- I can sleep in peace tonight