How can I get the pointer's absolute position?

I am doing an inventory system, and it’s almost done, the one problem is whenever I hover my mouse inside a button/item, the info doesn’t pop out at the right location. Why is that? I’ve used:

“Get Mouse Position then make Vector 2D”
and
“GetScreenSpacePosition to AbsoluteToLocal”

this is what happens for the both of them:

but it doesn’t get the right location of my mouse. I’m using 1280 x 720 resolution. Hopefully, I can get an answer to flexible resolutions, window mode and full screen mode.

And this could be a little out of the topic, but how can I set the proper Zoffset for my widgets? Because sometimes, the item info pops at the right location but is blinking so fast, it makes my eyes hurt. I am setting the inventory to Zoffset 1, the item info 2, but it still blinks.

Usually you can’t get cursor position in world space, because your screen is 2D and world is 3D. You can get cursor position on certain plane, but it is 3rd axis.
So what I wanna say: you can get only a ray of mouse pointer as normalized vector and position from where it’s been casted.
You need to call “Convert Mouse Location in World Space” on required player controller to get camera origin (position) and mouse pointer direction (direction). Now you need to trace a line from “position” to “position + direction * maxRayDistance” and see what it hits. And it is not depends on resolution or FOV.
If you set ZOffset then it should work just fine, maybe your widget turning off and on every frame. Widgets can’t “fight for Z” because they always somehow sorted even if they have same Z order. I should say that HUD has most stable rendering I’ve ever seen.

Ok bro, I think I understand what you’re trying to say but you lost me in

“Now you need to trace a line from “position” to “position + direction * maxRayDistance” and see what it hits”

how am I supposed to get the result of the linetrace? Should I take something from the hit result then put it in Set Position Canvas Panel Slot?

I’ve got the answer to this. I just used “Get Mouse Position scaled by DPI” then convert it to vector 2D then viola!

Whoops, I thought you mean cursor in 3D space… My fault :slight_smile: