Why is my 3rd person character not shooting at the crosshair?

Hi, im making a 3rd person shooter and im using projectiles as bullets not line trace but the projectiles don’t shoot at the crosshair they shoot to the left and down a bit. This is my blueprint for the projectile spawn.

It seems that the offset occurs because you are transferring the camera’s rotation vector over to the muzzle location of the weapon when you spawn the projectile. Since the projectile origin is different from the camera location, the projectile is aimed at a slightly different part of the scene than the camera.

If you subtract TraceStart of the second line trace from ImpactPoint of the first line trace, convert to a rotator and feed that into the spawn transform of the projectile, you should end up with the rotation you need to hit the crosshair.

I have done that and now this happens… The line trace shoots backwards towards the floor and so does the projectile. i have flipped the inputs of the subtract and it does the same thing

It’s hard to tell what you’re aiming at in the picture but keep in mind that if the line trace hits nothing then ImpactPoint will return the zero vector which is what I suspect might be happening here.

For those cases where you are aiming at the sky or into the void, what I usually do is calculate a distant point from the camera position in the direction the camera is aiming and then let the projectile travel there.

thanks, sorry about the picture, the guy was shooting into the void so the line trace shot at my feet, how would i go about making a distant point for the projectile to hit?

You can use this to get the location to aim at

Subtract the projectile origin from the result to determine the direction that the projectile should travel.

All of this would be in response to the first line trace returning false.

I have made this and set the trace distance to 10000 but the same thing still happens, i used a branch and connected the line trace to that so when i shoot at an object it hits perfectly but still hits the floor if not. when you mean the result do you mean the result of what you have in the image?

Dont worry aha i fixed it, all i did was connect the false of the branch to the wrong one! Thanks so much for the help!

Awesome, glad you got it working :slight_smile:

Hi I am having the same issue with my project. Do you mind to post your complete BP here to help me out? Thanks!

Sure thing! Sorry if its really messy i just tinkered until it worked.

alt text