Custom cursor targeting is slightly off?

Hi there, first time using a custom cursor and for some reason it is throwing off the targeting of my player’s shot.

This has not been an issue with the standard cursor.

Sometimes the shot is accurate to the center of the cursor, but only in specific positions (it’s a top down 2D game).

You can see the issue here:
https://imgur.com/a/2FlheGm

Can you share your code for setting the cursor texture? Specifically, what value did you pass in for the “hotspot” parameter? The hotspot determines what part of the image is considered where the pointer actually is.

Right now it looks like the hotspot is approximately the center left portion of your texture.

Err… no code used? I’m using the project settings to set the default cursor.

Hotspot is set to 0,0

The strange thing about it is that it sometimes is right on (as seen in the GIF, aiming bottom left and bottom right), but then mostly it’s a little off. Any thoughts?

You need to set the cursor hotspot. Set the “x” coordinate to half the width of your texture I think? Experiment with it until it looks right.

The reason it looks right sometimes is similar to the reason a broken clock looks right twice a day: that axis just lines up with the default hotspot such that the projectile also goes through the center of the cursor.

You are legit the savior of the day!!!

Because it is 32x32, I set the hotspot x & y to 16. Works like a charm. Thank you!!!

1 Like