Object Not Aligning Precisely with Crosshair Using GetLocalForward()

I’m having trouble aligning an object with the player’s crosshair. I’ve used GetLocalForward to calculate the direction the player is looking, and I moved an object in that direction, but the object doesn’t align correctly with the crosshair. I’ve tried drawing a debug line from the player’s position to the calculated direction, but the line ends up a bit below the crosshair.

Prop.Hide()
Forward:=Character.GetViewRotation().GetLocalForward()*Dis
Aiming:= Playerpos+Forward 
Prop.MoveTo(Aiming,rotation{},0.1)
DebugDraw.DrawLine(Playerpos, Prop.GetTransform().Translation, ?DrawDurationPolicy := debug_draw_duration_policy.Persistent)

Hi @Soy_Ema_31 :

Could you provide a more complete code sample? For example, how is Dis calculated?

“The variable Dis is a float with a value of 500.0. Since GetLocalForward() gives us a unit vector, Dis is used to set the length of the vector.”

Hey, hope i’m not too late. Actually the view rotation is a vector. So when you draw the line you have to use the view position not the player position.
Your DrawLine function is building a line parallel to the view vector.

looks like you’re using FortCharacter.GetTransform().Translation for Playerpos to offset using the unit vector.

Use FortCharacter.GetViewLocation() instead.