hey guys I have a bunch of points on either side of this wall (hidden until they glow), I just want to highlight the points that are on the side of my cursor. So in the picture below, that would be on the left side of this wall. So the points on the left should only glow not the right.
How do I determine if the points are on the side of the cursor? Its an interesting vector math problem…
However this is not working for me as you can see from the picture. Both left and right points are glowing. Anything wrong with my math?
My solution is:
- get the direction vector from wall to point (B)
- get direction vector from wall to cursor (A)
- get dot product of A and B
- if dot product is positive, then that means the points is in the direction of the cursor from the wall
If this helps others like me, this is to make a RTS cover system mechanic similar to CoH2 or Men of War