I'm learning Three Js and I have the following problem: I have an arrow of a fixed length r
centered at position (x, y, z)
and I want the arrow to rotate to track the mouse. If the mouse is further away from the center than r
, I want the z
component of the arrow to be 0, but if the mouse is within distance r
from the center, I want the arrow's z component to be set to the remaining length i.e. Math.sqrt((arrowLength * arrowLength) - (dx*dx) - (dy*dy))
.
How do I do this?
My question is similar to this question but the key difference is that I don't know the dz
component in advance.