Line Trace not hitting centre of the screen?

Hi, first time poster here, so apologies if this is a really easy fix and i’m just completely missing something

I have a line trace set up from my camera but it is hitting nowhere near the centre of my screen, I thought it might have been the variable i set up for bulletspread but that is only a +/- 10 vector so is only making a tiny tiny difference until i want to set it up properly. Any ideas or help would be very much appreciated!?!?

Use the Camera Location instead of the viewport center. Drag from Get Player Camera Manager and search for Get Camera Location, then use it instead of Deproject Screen to World for both Start and Add Vector.

I did initially try something similar to this but was getting the same result,

The only way that i’ve managed to get it to a reasonable centre is by taking 40 off the Z axis at the plus point, but that throws off the line trace depending on the distance of the shot :confounded: i’ve even took the bullet spread variable off just to make sure!

Perhaps it’s the reticle being drawn at the wrong coordinate.

1 Like

The linetrace is perfectly aligned, your reticle is not.

3 Likes

If you are drawing that reticle in UMG you will want to set the pivot point on it to 0.5, 0.5 (assuming its a square image).

On the UMG item panel it would be Details >> Render Transform >> Pivot.

That was exactly it! I was aligning the crosshair with the middle anchor point but i’ve adjusted the transform and it lines up great :slight_smile:

2 Likes

This worked perfectly! Thank you!!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.