[BUG?] Project function in HUD BP

Hello!

I have question about using Project function in HUD Blueprint, because I get some strange behavior with it in Unreal 4.2.1.

So. For example I have some object in world, which can be specified as “target” for pointer on HUD. In HUD BP I get it location, project it to screen using Project function and make few math operations to rotate pointer to that “target”.

It works fine, until this target object on screen, but if it somewhere out of screen, maybe far than 10-20K units, function start return wrong coordinates, and pointer direction is wrong.

It can be easily reproduced if you use Draw Line between center of screen and that “target” location.
When target be far out of screen, line will change direction.

Any advice about this problem?

Thanks!

Here is my HUD blueprint:

And video:

Purple line drawn between the center of the screen and "target" location. As you can notice - it changed sometimes to wrong. On screen you can see output result of projected vector.

+1, have the same bug :frowning:

I think the trouble of projected object position with it’s relation to screen position and orientation.

Here is how it works:

10635-projection.jpg

If object on “positive side” of camera/screen it projected fine, but when it goes on the “back side” of screen plane, it’s projection returns wrong coordinates.

Guys, i have this problem too.
Time passed by, and actually i have this problem in the 4.9.

I tryed bot APlayerController::ProjectWorldLocationToScreen(FVector WorldLocation, FVector2D& ScreenLocation) and UCanvas::Project(FVector Location).

They give quite different results, but both wrong in the case described above.

Hello zamy,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed set of steps in order to reproduce this issue on our end?
  3. Could you provide screen shots of any blueprints and/or code that may be involved with this issue?
  4. Could you elaborate on what it is exactly that you would like to do?

I have the same Problem!

I’m currently working on a small test Space Sim for fun. In the HUD I’m drawing a target icon over the selected enemy and using the “project” function to get the screen coords of the enemy’s world location.
This is where I get weird behavior: If the Enemy is behind me, an extra icon is drawn on the opposing coordinates in front of me. I think it should only draw if the enemy is in front of the Camera.

Now, I could hide the icon, if the target is behind me, but I’m also drawing an icon on the edges of the screen if the target is outside of the view frustrum, so the player knows in which direction to turn. I need proper projected coords for this, even if the target is outside the view. :frowning:

I think the sketch from redbox hits the nail on the head. If the coords you want to project is behind the screen plane, the project function output weird coords. Note: it has nothing to do with the screen borders but with the screen plane.

Edit: I think I’ve found a work around:

In the HUD BP the functions “Project”, “Project World To Screen” and “ConvertWorldLocationToScreenLocation” all output wrong coords behind the screen plane in one way or another.
BUT the function “Project World Location to Widget Position” works actually perfect, at least in my case.

Redbox: Could you test it in your project? If it works on your side too, it would show the developers how the project function should behave in these cases.

Hello Xharthok,

Could you try looking over the questions that I have asked zamy, and provide the additional information requested? This will help narrow down what issue it is exactly that you are experiencing. Question number 4 of course has already been answered by your original post.

Hello Xharthok,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.