Glue mouse to object

Hey everyone,
is it possible to fixate a cursor to certain XY-coordinates, as long as it remains in a specified area? I want to “jump” from the center of one game object to the center of another game object when a XY-threshold is reached. Do you have any suggestions?
Regards!

If you are using the First Person Controller, make the camera a parent of the object.

You’ll have to:

Use a software mouse cursor (required). You’ll use a blank image so that nothing is actually drawn.

Decouple the position of the cursor from the position of the mouse.

Draw the mouse cursor manually (with something like a GUI.DrawTexture).

In short, you’ll do a raycast each frame. If the raycast “hits” on of your desired snap points (you can use a sphere collider if you like) then you draw the cursor on the object hit. If it doesn’t hit a collider, you draw the cursor at the location of the mouse.