Can anyone tell me why my widget isn’t being centered to the cursor? Here’s a clip of the problem:
Here’s the widget:
And this is the the handling for the cursor. SpongeTracing just changes the visibility of the widget.
Can anyone tell me why my widget isn’t being centered to the cursor? Here’s a clip of the problem:
Here’s the widget:
And this is the the handling for the cursor. SpongeTracing just changes the visibility of the widget.
Ok so the problem is to do with viewport scale. If you were in true fullscreen mode the widget would be at the mouse cursor, but in the editor window you have a scale issue.
If you use GetMousePositionOnViewport
rather than GetMousePositionOnPlatform
you would get the result you were after. Because Platform uses the hardware resolution of your computer and Viewport uses the current editor window size. You will also want to uncheck bRemoveDPIScale
on the position setter.
You also need to be aware of how the SetPositionInViewport
is anchoring your widget. In your above image you would actually want the alignment on the X and Y both set to 1 rather than .5. I would suggest using something like an Overlay instead and offsetting it using the render transform translation. (You could also use just the image without wrapping at all but you’ll get a single full frame of the image when it first appears)
That should get your current setup working as you want it to, however I would suggest instead looking into Hardware Cursors as it will always be a cleaner and more performant setup than rendering a widget (unless you are planning on doing fancy animated cursors and whatnot)
Thank you for the detailed response! The removeDPIscale is what got it working at the end but I did what you said about using Overlays. I’ll definitely take a look into HardwareCursors! Thank you so much!