# How do I make my bullet go to my crosshair?

**URL:** <https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236>\
**Category:** Blueprint\
**Tags:** line-trace, socket-reference, unreal-engine, UE4, Blueprint, question\
**Created:** [November 8, 2018, 5:15am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236 "2018-11-08T05:15:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![OG\_FATFACE\_420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OG\_FATFACE\_420](https://forums.unrealengine.com/u/OG_FATFACE_420)\
**Post date:** [November 8, 2018, 5:15am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236/1 "2018-11-08T05:15:12Z")

</div>

So, I have a Crosshair in the direct middle of my screen. I have a weapon set up that when I fire, it will use the spawn actor class node to spawn in the bullet. The only problem is, that the bullet goes where ever my gun is facing because the bullet is coming out of the socket. How would I make my bullet go to my crosshair? Would I have to use a line trace? How would I use a line trace? Help is appreciated! Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b5891cd6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b5891cd6](https://forums.unrealengine.com/u/anonymous_user_b5891cd6)\
**Post date:** [November 8, 2018, 6:01am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236/2 "2018-11-08T06:01:46Z")

</div>

While you can draw a trace you don’t need to in this case. Within the event tick set a custom variable “mouse location” by using:

‘get player controller’ → ‘get hit result under cursor by channel’ → ‘break hit result’ → ‘set’

You can now use the custom variable location along with the location of where the projectile is spawning to help build a transform for the ‘spawn actor’ node:

‘find look at rotation’ → ‘make transform’ → ‘spawn actor’

Plug the projectile spawn location and mouse location into “start” and “target” pins respectively on ‘find look at rotation’ node. Plug the projectile spawn location and the result from rotation node into “location” and “rotation” pins respectively on ‘make transform’ node. Should give you the correct transform.

---

<div class="post-metadata">

**Author:** ![OG\_FATFACE\_420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OG\_FATFACE\_420](https://forums.unrealengine.com/u/OG_FATFACE_420)\
**Post date:** [November 8, 2018, 6:26am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236/3 "2018-11-08T06:26:25Z")

</div>

Can you show me a blueprint of this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b5891cd6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b5891cd6](https://forums.unrealengine.com/u/anonymous_user_b5891cd6)\
**Post date:** [November 8, 2018, 6:38am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236/4 "2018-11-08T06:38:26Z")

</div>

In this project the ‘sphere’ object is where the projectile spawns.

 ![258870-spawnactor.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/6/f86dce5c506d1032568415f757a3a424f0117bca.png)

---

<div class="post-metadata">

**Author:** ![OG\_FATFACE\_420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OG\_FATFACE\_420](https://forums.unrealengine.com/u/OG_FATFACE_420)\
**Post date:** [November 8, 2018, 3:59pm UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236/5 "2018-11-08T15:59:56Z")

</div>

Hello! I am just wondering about if I can get the bullet to come out of my socket. If so how?

---

<div class="post-metadata">

**Author:** ![OG\_FATFACE\_420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OG\_FATFACE\_420](https://forums.unrealengine.com/u/OG_FATFACE_420)\
**Post date:** [November 8, 2018, 4:01pm UTC](https://forums.unrealengine.com/t/how-do-i-make-my-bullet-go-to-my-crosshair/437236/6 "2018-11-08T16:01:35Z")

</div>

Hello! Is there any way to make it where the bullet comes out of the socket. Would I have to get the socket location. If so how?
