Silly problem with mouse tracking

I’m sure that solution is quite simple but I cannot figure it out. I’ making FPP game. I use this great script for crosshair: http://answers.unity3d.com/questions/203653/smart-crosshair.html
and I lock and hide a cursor in a middle of screen. The result is following:

You probably see the problem right now. I use mouse position to interact with object. The cursor is invisible during a game so to interact withy an object player needs to place crosshair a little higher. How do I make the mosue lock a little lower or a crosshair go a little higher?

EDIT: I just noticed one more problem. When I build a game for WebGL it gets even worse. I don’t know where cursor gets locked but definitely not in the middle. Interacting with objects is impossible. What’s going on here?

I’d recommend ignoring the mouse cursor completely, and only interact with objects when your crosshair is over them. That completely eliminates the need to synchronize the mouse cursor with the crosshair.

Yep, what @blizzy said. Take any references to Input.mousePosition (or Event.current.mousePosition) out of your code, and instead, just cast a ray through the center of the viewport. Whatever that ray hits, that’s what object you deal with.

2 Likes