I'm writing a basic Turn-Based Strategy game using Unity3D. It's not grid-based. I've come to the point where I'm coding unit movement, and I'm having trouble figuring out how far to move the units based on the mouse position. The following image is what I want:
The unit should snap forward along the red vector; it will always move in the direction it's facing. The reason I'm doing it this way is because I want the user to be able to see the result of their move, and I want to avoid some sort of GUI slider. The blue vector represents the vector from the mouse to the target point.
So, to sum it up: how do I calculate the movement (red) vector, based on the unit and mouse positions? Pseudo-code would be great!