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 to Trace from screen mouse position to target in Blue Print

Hello, I've been combing over some posts for a way to trace from the screen mouse position to the target you are trying to click. I've come close but nothing seems to match the screen pixel to the actual target pixel I'm clicking on. The screen pixel appears to be easy enough to get using "Convert Mouse Location to World Space". I'm a bit of a noob when it comes to vector math. Any takers on helping me understand the means in which to Blue Print a solution for finding the position/ vector from the screen pixel to the target. I'm using the 3rd person template so the camera is actual rotating behind the character.

Product Version: Not Selected
Tags:
more ▼

asked Apr 05 '14 at 09:52 PM in Blueprint Scripting

avatar image

Thumper
966 143 150 390

avatar image Thumper Apr 05 '14 at 11:25 PM

This is where I'm at so far. All I've got is the mouse coordinates on the screen.

alt text

tracing.jpg (156.2 kB)
avatar image Thumper Apr 05 '14 at 11:34 PM

Okay so now I've made it here. This is getting me very close. It appears that the ray is always casting in the correct direction but it's offset a little. Definitely not hitting the pixel out in the distance that I'm aiming at but I could certainly hit an object.

alt text

tracingclosest.jpg (145.9 kB)
avatar image Thumper Apr 06 '14 at 12:21 AM

Here's a shot of the traces. You can see how they angle inward towards the center of the screen. Am I reading this correctly, do the thick red blocks at the end of each trace indicate where the trace hit the environment out in the distance? Either way it's coning inward/ outward and not landing perfectly on it's target.

alt text

tracingoffset.jpg (175.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi, there is a special functional available in blueprint. alt text

more ▼

answered Apr 06 '14 at 08:39 AM

avatar image

BiggestSmile
1.6k 54 38 105

avatar image BiggestSmile Apr 06 '14 at 08:41 AM

If you prefer to do that manually, start of the trace would be World Location pin in Convert Mouse location to Wolrd Space node, to get the end of the trace, multiply World Direction pin by some amount, depends on the length of the trace, then add World Location to resulting vector after multiplying. Hope this helps. alt text

(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