I have two Vectors: the Vector I need to move (Vector A) and the Vector I need to get as close as possible to (Vector B). I also have a Ray R (an origin + axis/direction) which Vector A should be rotated around. How do I find an Angle, that will bring Vector A as close as possible to Vector B, when rotating around the Ray R?
I am building an editor extension for Unity, a custom gizmo for various transformations of objects: translations/rotations/scales. Among other things it should allow for "vertex-snap rotations" In the picture above, the tool should be able to rotate the cube in such a way around the custom axis, that Vector A and Vector B get aligned. This case is an easy one, because the axis is the Wold Y axis, I need a general solution for any axis and any kind of vectors.
The reason why I might have sounded confusing is because my tool allows to set next to any constrains on what rotations should be performed: the user can turn off X-axis rotation (to only rotate in YZ-plane), they can turn off two axes and even do the same for the object's local space. I've got a method that rotates the cube around an axis with an angle, all I need is to find the closest angle BUT for a specific axis.