Moving 'eye' along a vector while focused on a target I am struggling a little bit with my trigonometry. I am writing a little 3D simulation in which I have a character (the 'eye') which is always fixed on a target.
I want to move along a vector from any given position left or right along a vector. This would be the equivalent of walking left or right in the real world, but while always facing the target.
I have drawn a picture that I hope will help.

I think what I need to do is figure out the angle my eye to the target with respect to the x and y axis (in 2D), but am stumbling to figure out how that fits into moving along the 'blue line' in my diagram.
Thank you for any hints or guidance!
 A: If you can assume that the line going from your eye to the target, $L$, is always on the XY plane, i.e. the same plane containing "left" and "right," you can calculate the perpendicular line $P$ by finding the dot product (and expanding into components):
$$ L \cdot P = 0 \\
\implies x_L \times x_P + y_L \times y_P = 0$$
We then have an underconstrained problem because this is the equation of the entire line passing through the eye perpendicular to the target, meaning we have a free parameter left over - which makes it awkward to write code for. To find a unique solution, I'm going to arbitarily assert that I also want my answer to be a unit vector, which lets me substitute:
$$ x_L \times x_P + y_L \times \sqrt{1-x_P^2} = 0$$
Wolfram Alpha solves this to say that the x-component is given by,
$$ x_p = \frac{y_L}{\sqrt{x_L^2 + y^2_L}}$$
You can then find the corresponding $y_p = \sqrt{1-x_p^2}$ for the two components of the perpendicular vector, i.e. the direction of left or (depending on sign) right relative to the target.
Note that if you just calculate this once and step multiple times along it, you won't get a circle, because each step also moves the perpendicular. You'll also need to rotate the eye to point back towards the target - the angle to rotate by is given by $\arctan(\frac{|s|}{|L|})$ where $|s|$ is your step size. (The original position, the new position, and the target form a right triangle with the former at the right angle.)
A: First, project the target onto the ground plane if it's not already there (i.e., just ignore its $z$-component). Let the vector from the eye to the (ground) target be $\Bbb v = (\Delta x, \Delta y)$. Normalize this to a unit vector $$\Bbb u = \frac{\Bbb v}{|\Bbb v|}.$$ Then there are two unit vectors perpendicular to this on the ground plane, corresponding to stepping left or right:
$$\Bbb p_L = (-u_y, u_x)$$
$$\Bbb p_R = (u_y, -u_x).$$
