Screen.lockCursor messes my rotation

Hi,

I have implemented a camera which is child to a certain GameObject. To rotate my camera around the point I simply rotate this object around global X (up/down looking) and Y (left/right looking) axes. I’m using mouse for that - in my Update func i calculate deltaMousePosition - difference between current mouse position and the one from the frame before. I’m doing this only when I hit right mouse button. I additionaly wanted my mouse to be locked for the time-being, so I could rotate my camera endlessly (not being bothered by screen edges). Unfortunately when I do this, something strange happens. Camera jumps to some specific rotation and then it locks - does not rotate an inch.

I suspect, it is because now my deltaMousePosition is always equal 0. But if so, then how am I supposed to simultaneously calculate angles to rotate and have my mose locked?

You can use Input.GetAxis to read mouse movement values without the position, by default they should be set up as “Mouse X/Y” in the input manager. Check out the Input class in the documentation for more info