How do you make crosshairs and aim animations when you make games?

How do you make crosshairs and aim animations when you make games?

I made an anime like this and designated crosshairs as UI. Linetrace fires from the camera and proceeds, so if you lower the crosshairs, it doesn’t fit the launch range.

What do you guys do when your crosshair and the animation position you aim at don’t match?

It differs per case. You could snap the aim to the correct position almost instantly and that would work even for some realistic games but would look really strange when you do it with a tank or other vehicle. Think of the aiming system for tanks in Warthunder.

How some games do it:

  1. Always shoot towards the crosshair or target regardless of what the barrel points at.
  2. Always shoot from the “center” of the camera towards the crosshair at the center, same as 1.
  3. Don’t shoot until the character model / animation direction is aligned to the crosshair direction.
  4. Use IK to align the barrel of the gun towards the crosshair as fast as the animation allows it.
  5. Don’t use a centered crosshair but do a line trace from the barrel of the gun and show the crosshair in 3D using a widget component.

For aiming I personally use IK and a more realistic approach where the hands, the gun barrel, all are using IK to point where I’m looking at.