#Making custom mouse cursor be on the top of the mouse

7 messages · Page 1 of 1 (latest)

lean ravine
#

I’m trying to make a targeting reticle style mouse cursor, but by default the mouse cursor position is on the corner of the texture. Is there a way to change that in the settings?

#

Right now my temporary solution is to manually offset functions like get_global_mouse_position() but that is likely going to be tedious to do all the time

lean ravine
#

Nevermind, I managed to find the settings

sleek geyser
#

It would be good form to explain your solution instead of just saying that you have one.

crimson mica
#

I have been wondering for a while how to do this, but never got around to try and find out.
So what does your code look like?

The way I found was to create a script and autoload it.

'''
extends Node

var cursor = load("Path of your cursor image")

func _ready() -> void:
Input.set_custom_mouse_cursor(cursor, Input.CURSOR_ARROW)
'''

CURSOR_ARROW would be the cursor you change and this one is the default arrow.
There is other parameter called Hotspot, but from your description, it does not sound like you need it.

Here is the Godot Documentation where you will find the set_custom_mouse_cursor method
https://docs.godotengine.org/en/stable/classes/class_input.html?highlight=set_custom_mouse_cursor

lean ravine
#

That changes it universally