Tesla Dev has a tutorial on this. Do a google search for Simple Line Trace Tesla Dev.
The crosshairs that is displayed with the FPS template is not quite in the center of the screen so it will look a little off when shooting.
Tesla Dev has a tutorial on this. Do a google search for Simple Line Trace Tesla Dev.
The crosshairs that is displayed with the FPS template is not quite in the center of the screen so it will look a little off when shooting.
Tesla Dev has a tutorial about this. Search for Simple Line Trace Tesla Dev.
Also note that the crosshairs that’s on the screen for the first person template is not quite in the center of the screen. It’s very close but not quite.
Hey Recker I saw your video on YouTube and shooting towards crosshair is now working! I have tried almost all answers on internet but none of them is working for my projectile and I feel weird… I really need help on this. This is what I have but it is still off. I am having my shooting logic in Character BP class. I have a muzzle location on top of my character and outside of my capsule component.
No it doesn’t work for me I tried. I am using my camera to adjust my projectile arc in future (like projectile in GoW). And based on my BP I can’t see what is going wrong, but the projectile is not flying to crosshair.
In the line trace start use the cameras location and not the muzzle location.
It works now! I am using the same crosshair implementation as FPS template so it is a little bit off but it is a constant of no matter how I change my camera location or rotation. Can you explain why this does the trick please? And can you point me a place to find a good crosshair implementation? Thanks you so much!!!
Hey there, sorry I have long since lost the original files for those projects including the stuff I put on my youtube… I think what I did was cast a trace from the camera straight forward using the cameras rotation, while also getting the forward vector and setting the length to about 200 meters, and then I store the hit location if the trace, after which I spawn the projectile blueprint OR cast the actual projectile trace from the character…Directly after that spawn I grabbed the spawned actor and set its rotation with a find look at rotation node, using the spawn location and the hit location… what you can then do after is add some variation to that by breaking the rotation before its set, and adding a random node on each of the rotation axis, that will simulate spread… you could also do another thing where if the trace doesnt hit anything you could set a bool variable or something you just set the target of the find look at rotation node to a large number like 200 meters from the players position.
Thank you for the explanation! cyborgjynx has helped me out. I am pretty sure I get my projectile flying to crosshair correct now, but like he explained, the crosshair itself is a little bit off since I am now using the crosshair from FPS template. Gonna fix that now. Thanks again!
I have long since figured this out and have moved on due to losing the project and forgetting about this post…as such, Tesla’s video doesn’t exactly help, he was using a line trace whereas I was originally using a blueprint actor with a projectile movement component…
With a trace things will have to work a little different, but even then there are a couple of variations, there could be a bullet blueprint that casts the trace by itself, or the trace casting could be based straight in the character actor… Tesla while great keeps things simple, and bullets can get very complex if need be.
With the crosshair, you can go to the hud blueprint and subtract I think it was a value of 8 from the x and y of the crosshair location image… as far as I know the image origin is based on the top left of the crosshair and IIRC its only 16x16 pixels…
also I personally wouldn’t use the camera location as the start point for the trace as if there is something in between the camera and the player location even briefly while shooting it can cause issues with projectiles…
I see… but using camera location as start position for line trace solved the problem for now… Or I think I can create an empty mesh on top of my character’s head and aligned with camera location. What did you use for that start point?
Check out my comment to your other post, I made a short breakdown…
This sounds like another question on the forums so if anyone wants the blueprints, I found some here:
Although, I haven’t manged to get them to work in my 3P project, that’s probably just cause I’m an newbie
This guy has an amazing explanation that I barely understood but it seemed to solve your problem (If you haven’t already solved it 4 years later) But this is manly for anyone who finds this post and needs a good explanation:
Credit to Taydra for solving the problem btw