x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text

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.

Product Version: UE 4.10
Tags:
iteminfo.png (2.2 MB)
more ▼

asked Jan 10 '16 at 04:49 AM in Blueprint Scripting

avatar image

Anjobee
1 3 4 5

avatar image Anjobee Jan 10 '16 at 04:58 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Jan 10 '16 at 11:18 AM

avatar image

HungryDoodles
495 30 25 40

avatar image Anjobee Jan 11 '16 at 02:02 AM

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?

avatar image HungryDoodles Jan 17 '16 at 12:22 PM

Whoops, I thought you mean cursor in 3D space... My fault :-)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Jan 11 '16 at 05:53 AM

avatar image

Anjobee
1 3 4 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question