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 could I Convert screenpoint to worldspace?

Is there an easy way to convert any point on my screen( x,y ) to world-space and direction? I noticed there is functions for it in C++ in the PlayerController.cpp file but they are not accessible in Blueprint. Is there a reason for this or can I simply make them be callable in blueprint?

Product Version: Not Selected
Tags:
more ▼

asked Mar 24 '14 at 02:18 PM in Blueprint Scripting

avatar image

Osman
149 12 16 22

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

2 answers: sort voted first

Isn't there some Transform nodes in blueprint, which will do this for you? I think they accept a vector and project it to View, World...

In any case you cannot exactly convert an X,Y point to a point in the world, because you are missing one axis. But you can do a trace from the converted point along the direction of camera to get that.

more ▼

answered Jun 03 '14 at 09:17 AM

avatar image

mindfane
3.4k 154 52 271

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

There is a blueprint method for this, please see screenshot.

alt text

capture.png (89.8 kB)
more ▼

answered May 07 '14 at 12:44 AM

avatar image

brettclutch
123 13 12 14

avatar image Osman May 07 '14 at 11:52 AM

You missed my point. I don't want to convert the mouse position, I want to convert ANY screen position to world-space. My game is not using the mouse.

avatar image Steve Allison STAFF Jun 03 '14 at 09:47 PM

Hey Osman,

The Deproject functionality is what you're looking for which is available in C++. We have exposed this functionality to blueprints internally, but unfortunately not in time for the upcoming 4.2 release. This should, however, be available in the 4.3 release.

-Steve

avatar image ScottSpadea Jun 03 '14 at 08:49 AM

maybe try this:

Xdeg=(Xpos/ScreenWidth)*FOV-(FOV/2)

Ydeg=(Ypos/ScreenHeight)*FOV-(FOV/2)

then you could rotate your foward vector by those x and y degrees to get a vector pointing in the direction you need to trace. normalize and multiply this by the distance you want to trace to get the end value, and use the camera position as the start value. the location of the hit result of the line trace should be the value you want.

i haven't tested any of this, but the math sounds like it could work. i believe epic is working on coordinate space transformation nodes for a future update, so if this doesnt work, you can wait for their method.

(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