Confined mouse cursor clips out of window

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By neorunner

I’m currently trying to develop an isometric RPG(ish) game which should implement a mouse cursor which is following my mouse movement. Furthermore said cursor should stop at the edge of the “game window”. So far this works fine. A small detail which bothers me is the fact that the cursor is stopping, but is still clipping out of my game window. I’ve now worked out two approaches to solve this problem:

A.) Hard-coded borders which incoporate the cursor size
B.) Use some solution which is provided by the Godot Engine itself
C.) Implement Cursor as a sprite

Now, considering option B.) is there any solution which may be a good fit? I’ve already looked for a hint inside the documentation. Unfortunatly I couldn’t find anything.


Thank you for the advice. However, I’m already using the MouseMode you’ve mentioned. (In theory) the problem is non-existent because the top-left part of the cursor is stopping at the edge of the game window. The practical problem is that the rest of the cursor is hanging outside of the window

I want to use a confined mouse cursor which stays inside the window completly. Completely means that the cursor and its sprite are inside the game window all the time.
In the MouseMode MouseMode.MOUSE_MODE_CONFINED the pointer of the cursor is stopping at the edge of the game window. However, the sprite “overflows” outside of the game window

Thanks in advance for any help

By clipping do you mean that part of the cursor is out of the window when cursor is on the right and bottom edges of the game window? Also are you using mouse mode confined or something else?

mirageowl | 2021-04-05 15:36

Can you include more information about the behavior you are aiming to get?
I’m not sure about what you need but you could try moving the mouse cursor based on the distance from the center.

Bubu | 2021-04-05 15:40