# Object Not Aligning Precisely with Crosshair Using GetLocalForward()

**URL:** <https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [August 12, 2024, 6:01pm UTC](https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107 "2024-08-12T18:01:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soy\_Ema\_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soy\_Ema\_31](https://forums.unrealengine.com/u/Soy_Ema_31)\
**Post date:** [August 12, 2024, 6:01pm UTC](https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107/1 "2024-08-12T18:01:54Z")

</div>

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.

```auto
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)

```

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/3/e83e0997fd02974d6c08fb843a3194284b7fe1ce.jpeg)

---

<div class="post-metadata">

**Author:** ![sonictke](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sonictke/32/924209_2.png) [@sonictke](https://forums.unrealengine.com/u/sonictke)\
**Post date:** [August 28, 2024, 10:04pm UTC](https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107/2 "2024-08-28T22:04:23Z")

</div>

Hi @Soy_Ema_31 :

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

---

<div class="post-metadata">

**Author:** ![Soy\_Ema\_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soy\_Ema\_31](https://forums.unrealengine.com/u/Soy_Ema_31)\
**Post date:** [September 15, 2024, 11:11pm UTC](https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107/4 "2024-09-15T23:11:31Z")

</div>

“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.”

---

<div class="post-metadata">

**Author:** ![CEESPMaczek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CEESPMaczek](https://forums.unrealengine.com/u/CEESPMaczek)\
**Post date:** [January 15, 2025, 7:54pm UTC](https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107/5 "2025-01-15T19:54:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Choud](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jeremy_choud/32/907645_2.png) [@Jeremy\_Choud](https://forums.unrealengine.com/u/Jeremy_Choud)\
**Post date:** [January 18, 2025, 5:12pm UTC](https://forums.unrealengine.com/t/object-not-aligning-precisely-with-crosshair-using-getlocalforward/1973107/6 "2025-01-18T17:12:39Z")

</div>

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

Use FortCharacter.GetViewLocation() instead.
