Calculate the distance between the mouse and an object


How can I simulate for the desktop version what I do on the mobile version?
That is, calculate the distance of the object to hide the crosshair when it’s close to the player?
In the mobile version I used the speed variable, but in the desktop version I don’t know how to calculate it without having to create an object that follows the cursor.

You can use the expression CursorX() and CursorY() to get the position of the cursor.

Simple use distance between points with the center of the object and CursorX and CursorY

image

Can you specify a bit on what your actual goal is? From what you said Im assuming your making a 3D project in which the crosshair disappears when near the object.

Is that correct? If not then please specify a bit more. Thank you​:blush:.

Thanks guys I solved it