# Finding a vector perpendicular to a current vector

Assume, that we have a player that has a vector direction. We have an enemy, that is shooting a player. And the task is to find out from which side the enemy is shooting. I know the algorithm, how to find this.We need to find the left vector and then do a dot product with enemy direction vector. The question is to find the left or right side of player's current vision and it means to find out the vector perpendicular to the player's vector. What's the easiest and the most least computation way to find it.

• I don't think you can really have a normal to a vector, since normals are for planes. A single vector doesn't define a plane (unless of course that vector IS the normal) Sep 25 '14 at 20:22
• For this sort of 3d stuff adding a picture of what you are talking about can be very helpful. Sep 25 '14 at 20:45
• This question appears to be off-topic because it is about mathematics in a way that is unrelated to game development. Sep 25 '14 at 20:47
• Hint: rotate the vector 90° around the vertical axis. Sep 25 '14 at 21:23
• bool is_left=dot(cross(forward, up), enemy_dir)>0; Sep 26 '14 at 0:29 Once you figure out "up" you simply do the cross product like @JarkkoL already explained. If you multiply with the reverse order, you"ll get the opposite direction. So in other words, if left == cross(forward, up) than right == cross(up, forward). You can also simply negate one to compute the other.