Third Person Crosshair Help Pls

I just can’t figure out how to get my crosshair to perfectly align with my desired point. I’m drawing a vector trace from the gun of my tank and converting the point hit or trace end to screen space and using those coordinates to translate my crosshair on screen. I just don’t know where in UMG I should position it so it would translate accordingly. There seems to be different fudging required at different aspect ratios.

So I find crosshairs and standalone floating icons to be easier to draw with canvas. But you can use UMG

First, I would center that crosshair on the center anchor. Then, you can set the size of the widget to be the exact dimensions of your image. Then it should work.

Are canvas and UMG not the same thing? I’m new to the UI schema . For floating UI like health bars I’ve been using widget components on actors.

After I make the widget I did what you suggested and set the widget’s desired size in viewport to the same as the image and I centered the image and its anchor point in the center of the canvas panel. I’m still getting the same results where it floats off center. The degree of offset varies on resolution aspect ratio. I think the project world to screen function not working as expected.

Wait hang on, its being weird because the resolution in game user settings isn’t changing to match its window size.

I’m fixing the X position of my crosshair to now be resolution width / 2. In game debug statements print the following.
Image X translation: 800
Game resolution: 1600

And these numbers are the same no matter what size the standalone game window runs at.
Doesn’t the inner resolution of the standalone game window not change to match its size? I’m used to Unity handling this seamlessly.

What I did for my crosshair for my vehicular combat game was to remove the canvas, so all you have is the image. If you want you can put a size box first and then the image inside of that and you should be able to control the size as well. As for the screen sizes, maybe try using GetViewportSize instead?

I can’t quite recall if I had to compensate for the size of the image, so to center it - you would get its width, divide it by 2 and subtract the X position with that. Same for the Y position - I don’t have that project on my computer at the moment so I can’t check it out unfortunately :frowning:

.

Well UMG does have a canvas, but I’m pretty sure its not what I was referring to. Make a new BP class, base it on the HUD class. Inside this class you’ll want a draw HUD event. Use the node “Draw texture simple”. Put it in the center, offset by the image dimensions.

.

Well UMG does have a canvas, but I’m pretty sure its not what I was referring to. Make a new BP class, base it on the HUD class. Inside this class you’ll want a draw HUD event. Use the node “Draw texture simple”. Put it in the center, offset by the image dimensions.
[/QUOTE]

Oh okay I see what you’re saying. I just picked apart the first person template not too long ago and found their HUD. Is there an easy way to do animations using a draw event? The reason why UMG is my first choice for this is because my designers want to have animated crosshairs for different types of vehicle classes that show weapon gadgets and progress bars which I know how to do in UMG.

Hi. I spent some time with creating 3p crosshair. I was successful, however i met some problems.

Do you want to have your crosshair to move on screen or static in the middle of canvas in umg?

I created widget 100x100 px and inserted it in player controller. In PC im getting camera and muzzle of weapon and calculating trace. Then i move with widget to world place point where trace hot. But m drawing widget on screen place, not world… works perfectly but crosshair jumping so much when you hit near/far surface etc… its hard to aim with that.

Im going to rework my crosshair like this: i draw somewhere in umg crosshair (in middle probably) and then, i will shoot an set animation offset where i aiming. This has problems too, if you shoot to very short distances. Your anim pose may be deformed so much. I found this problem in paragon few months ago.

Summary: third person crosshair is real challenge to make it well…