For some reason my script inverts the y axis.
Hi, since you provided no further information, I will just tell you the whole process how I would do it.
- Create a UMG widget and add an Image to it (configure it to your needs size etc.). Anchor it to the top left. Set Alignment to 0.5, 0.5.
- Expose it as a variable.
- Go to your Player Controller Blueprint and create this widget and add it to the viewport (whenever it will be needed)
- Each tick you get the mouse cursor pos and set the position of the Image of the widget you created before (have to store it as variable somewhere)
- Optional: Don’t move it fully to the mouse cursor but only e.g. 1000px * DeltaSeconds in direction of your Mouse Cursor. This gives a nice delay when moving the mouse
Keep in my mind that y goes down from the top-left in screen space.
The other option is to use a HUD actor. There you can draw lines and build the crosshair yourself with no image.