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!
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.
Can you show me a blueprint of this?
Hello! I am just wondering about if I can get the bullet to come out of my socket. If so how?
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?