UE 5.6 third person game make crosshair to weapon muzzle

Hi, how can i aim exactly to the weapon muzzle .

I tried different things crosshair as user widget and crossshair as actor with actor to spawn at location.

maybe i forgot a simple thing but everytime when I aim the crosshair is on the right side and not exactly on the weapon muzzle.

Please help i working with blueprints

We talking Hip fire, or Aim down sight (ADS), or Optics crosshair?

In game pics would be helpful.


In general the crosshair is a standard user widget (controller owned/loaded) that’s 100% centered. This is what the camera is aimed at… center screen. The weapon itself is aligned to point “Roughly” toward it. You’ll drive yourself mad trying to get it perfect with every gun and animation. Yet, we do not need it perfect for shooting straight and what we are aimed at.

thank you for the quick response.

hip fire is done and works great but the aim is not so good.

so we talk about aim logic.

my currenty aim logic is screenshot 2 and 3.

and yes its driving me crazy i ask many AI and that was not rely helpful.

can i make a extra socket or something for the crosshair stick to the muzzle?

you see the crosshair is on the right side and the weapon is in the middle.

and what if i switch the weapon to shotgun or rifle

the aim animation of these weapons are different so the crosshair must be on a differnt place too or?

Typically for TPS you lock the camera to over the shoulder and use control rotation. Looks like your camera is currently offset to the right. Spring arm length is shorter too.

Also, most TPS toggle to an FPS view (camera on weapon) when you ADS.

i want to make a third person shooter like aim (resident evil 2 remake)

i have tried camera offset x 10 y5 and z 50
yet is the crosshair in the middle but the look of the aim is behind the character and not behind the shoulder.

pull the camera in closer then rotate it left (-z) until it lines up more with the weapon.

Instead of trying to pin crosshair to the front sight/muzzle, you could just do 2 traces when shooting. First trace from camera like usual, then trace from the muzzle socket to the hit location from first trace. For instant/hitscan weapons, use that result for the damage/impact fx/ect.. For actual projectiles use the second trace hit to find lookat rot from muzzle to feed the velocity and spawn. Might look like the gun is shooting sideways if camera is in a weird place, but if it’s within a few degrees of the bore axis, most people won’t notice.

It’s not about shooting. That’s easy and you don’t even need a trace to get the shot to hit crosshair. Just simple math. Op wants the gun to line up more visually with where the crosshair is.

Could also do the two traces in tick and move the crosshair widget to it. And probably use a dot product check to hide crosshair if it’s behind the gun.

@J_Wplay

I just tested various games.
Among them were GTA 5, Saints Row, and Resident Evil.
What I noticed is that when you switch between different weapons and look at their aim logic,
the crosshairs are not always exactly on the weapon; sometimes they seem a little off to the side, sometimes a little too high.

Maybe I’m overthinking it because I never noticed it when playing these games until I tried to do the logic myself.

can you send a screenshot from the blueprint aim logic with the camera settings?

maybe the camera aim settings like this?

One trick you can use to make the camera line up with the shot better is make a color/vector curve and get the time value from that using the spring arm length to set the target or socket offsets. If you print the arm length and hit play, you’ll know where on the curve needs to be tweaked for that zoom level. Could also do some math on that to fine tune the aim offset anim.

Typically aim offsets use a delta of actor/mesh rotation and the controller’s base aim rotation. But if the cam is in a weird spot, it probably won’t line up.

Spring Arm

  • Target Length: 80
  • Location: 0.0, 0.0, 60.0

Camera

  • Location: 0.0, 50.0, 10.0
  • Rotation: 0.0, 0.0, 0.8