I currently have a script attached to the main camera that raycasts against a certain object (starting from the current camera rotation), and if the ray hits, the camera is slowly rotated downwards until the ray does not hit anymore. This alone works fine.
However I also have MouseLook attached to the main camera so I can look around by moving the mouse. Both functions are absolutely necessary.
The problem is that, when the ray has reached the lowest point of the object, and the next raycasting returns false, MouseLook takes over again and moves the camera back to the point where the mouse was last - so it jumps to the point from which the raycasting first returned true. This has the effect that the camera jumps back up, moves downward slowly, leaves the object, jumps up, moves downward…
I want the camera to simply stop at the rotation from which the raycast first returns false again and not jump back to the last position. I thought I could just set the mouse coordinates to that position but apparently there is no way in unity to do that. Does anyone have any idea? I need this for my Bachelor project in a few days. :o