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"

Can't convert mouse position to worldspace with "OnDrop" function in UMG

I'm trying to make a drop and drop material system using UMG. I'm running into an issue when converting the mouse position from screenspace to worldspace when a widget is dropped on the screen. I'm using the results to run a linetrace from the sceen out into the world.

I don't run into this issue when running the conversion on tick, only when using the "OnDrop" function. If I get the mouse position from the player controller, it just returns as 0,0.

If I use the position from the "pointer event" in the function, the direction seems to be wrong, no matter the maths I use, causing the line trace to go out at an unexpected angle.

Here's the function: https://blueprintue.com/blueprint/6z90qytu/ You can see all the different ways I've tried to get the projection to work but I'm having no luck.

Here's the working blueprint from my pawn's event graph: https://blueprintue.com/blueprint/1ep5f89i/ This math doesn't work inside the widget as previously mentioned, the "mouse position" just returns 0,0.

I'd appreciate any guidance on this.

Product Version: UE 4.18
Tags:
more ▼

asked Feb 06 '18 at 12:18 PM in Blueprint Scripting

avatar image

wickerman123
125 1 1 6

avatar image wickerman123 Feb 06 '18 at 12:32 PM

I've got the system working by using a blueprint interface so the majority of the logic happens in the pawn blueprint. However the mouse position still returns 0,0 unless a delay is put between the interface and the linetrace. This tells me the mouse input is being consumed for a few frames after the drop event.

Here's the blueprint for this fix: https://blueprintue.com/blueprint/wkxy47um/

I'd like to keep the logic in the UMG blueprint. Anyone got any ideas on how I can get around this issue?

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

0 answers: sort voted first
Be the first one to answer this question
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