- Home /
Rotating a UI Element to look at the Mouse/Input Vector
Hi Everyone! I want to create a pause menu where a UI Object in the middle (like a compass needle) follows the mouse Input Vector (because this way I can also theoretically use controllers for the input) to point to the menu options that are spread around the center, kinda like the Skyrim Character Menu:
The Issue I'm facing with this mostly is that I can't get the UI Object to "Look At" the Vector or use the Input Vector as a Directional Vector. With a "Normal" 3D object I would create an object whose position is the Input Vector relative to the position of the turning object and then use the "LookAt" function. However, I'm lost as to how to do this without the help of that step because in a Screen Space Canvas I don't think I can use the "Normal" Coordinate System, can I? I also tried using
RT.rotation = Quaternion.FromToRotation(RT.rotation.eulerAngles, MouseMovement);
which produced some weird results, mainly the UI Object following the mouse movement way to slow, as if the origin point was far off, even though it was still rotating around the given anchor. I'd be happy if anyone had any suggestions/tips on what I can try next!