5
\$\begingroup\$

so my question is where to draw crosshair? I have some things in my mind like:

1): Draw it on the center of camera(which will stays on the center of screen always), but as my gun is little lower to the camera so my bullets will always hit little lower to the target, but at the same time every FPS draws crosshair on the center(correct me if I am wrong).

2): Draw it to the forward of bullet spawn point so bullets will always be on target. But this also has some issues, player can't just be standing freezed it will move a little so did the gun and in turn crosshair will also move, but I haven't seen any FPS with crosshair moving while player is standing to shoot or even walking plus this will also make the game tough or annoying.

3): Draw the crosshair little lower to the camera(camera.y - difference between camera.y and spawnPoint.y) so the crosshair and bullet spawn point are aligned, but won't it look little weird to have a crosshair little lower to the center of screen.

I had read Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle

What I get from this is that raycast from camera and fire the bullet in direction where the raycast hits, but the bullet will not be going out from the forward of spawn point and this will look bad. The guy explains something with the animation but I didn't get that point. In GTA V's FPS mode crosshair is being drawn in the center, hands and gun are little low from center so there is no way that gun will hit exactly at the center of crosshair but it does hit and we can see that bullet(not actually bullet, some kind of ray) is getting fired from muzzle of the gun, how do they do it? I am sure there is some kind of trick for that.

I don't know what to do or there are other ways of doing this, any help would be much much appreciated.

My question is similar to the given link but it don't have much information so I am not trying to be duplicate here I am just looking for some more information

Thanks for reading this

\$\endgroup\$
7
\$\begingroup\$

There are many reasons a designer/programmer would want to draw the crosshair on the exact center of screen, or a little lower. A hybrid system may even be implemented, taking advantage of the properties of these two systems in a game fich of different weapons, vehicles, interactive spots, and so on.

Drawing the crosshair centered or lowered can depend on some design choices:

  • Centered crosshair: typical style, almost every old FPS game and most modern ones have a centered crosshair. This way the visual range is balanced both horizontally and vertically. This way, when shooting we know the bullet is moving where we are looking at, because its starting position is the same as the camera (our "eyes" in the 3D world). This is a typical choice, as it comes natural for a generic user to focus on the center of the screen when interacting with a computer, and video game players are no exception. Also, if your game has HUD elements on different sides or corners of the screen, having a centered crosshair will let the player keep them under control without extra efforts for their eyes.
  • Lowered crosshair: drawing the crosshair slightly below to the center of the screen requires the programmer to mind that fired bullets aren't moving straight forward anymore respect to the camera orientation, instead their trajectory is sloped of a certain angle downwards. Having a crosshair below the screen center, means a player has to look a little up in order to still aim in front of him. Also, the visual range changes, as what lies above the horizon line gets actually prioritized than what lies below such line, like weapons, objects, or even your own legs. When it comes to user interface, if you designed the game to have HUD elements on the bottom only, they will be easier to read without losing focus on the crosshair.
  • Hybrid crosshair: some weapons will sport a centered crosshair, others will have a lowered crosshair. An example is aiming with a rifle vs. aiming from a mounted machine gun. Your choice.

In the Halo series, Halo PC/CE has always a centered crosshair, whilst the other titles have a lowered crosshair for weapons, which smoothly moves to the center of the screen when interacting with vehicles or mounted turrets. You can see similar differences in other games, such as Doom 3, Team Fortress 2, Crysis 3, the Battlefield series, the Call of Duty series, and so on.

enter image description here

Here, in (1) there's the classic centered crosshair: when looking straight forward, the player's pitch angle (whether he's looking upwards/downwards) is equal to 0 degrees, as one would expect. Then, in (2) we have a lowered crosshair. Now, if the player wants to aim again in front of him, he has to look a little up just like in figure (3).

But there's another more important reason this crosshair stuff is a thing, and it's related to the question you linked. One may ask:

How can I shoot bullets out from the camera, yet pretending they come from the gun barrel?

The player shoots at what he's looking at. That's why most weapons spawn bullets at the camera position instead of the tip of the gun. Yet, we must pretend bullets are still fired from the weapon.

We can achieve this by using a lowered crosshair, in combination with good character animations. A generic FPS biped consists of a character and a weapon. Look at the following image (Halo helps again):

enter image description here

Red is camera, blue is weapon. In figure (1), we have a centered crosshair and a horizontal rifle, so we should adjust weapon and arms orientation to reflect the direction of fired bullets. Alternatively, we can move the weapon closer to the head, simulating the act of aiming to reduce the distance between starting position of bullets and gun barrel.

On the other hand, in figure (2) the camera sports a lowered crosshair. The resulting effect is that the fired bullet will move so close to the gun barrel that they seem coming from there! We can do even better: draw the bullet only after it moves over the gun barrel, as the fire coming out from the gun will complete the whole effect. When doing this, it's good animating arms and head accordingly to the current direction the camera is looking at. Also, reducing the angle difference between bullets direction and weapon direction on the model, will give you a better result as the bullet is actually moving on a straight line trajectory. The closer the camera (the model head) to the weapon held, the better the final result.

\$\endgroup\$
  • \$\begingroup\$ Well now that is an answer, you seem to be a Halo fan:p, what I thought was that lowered crosshair would be better. I think with lowered crosshair we don't need to fire bullets from the camera, keep the gun as close to the camera as possible(but make sure the gun is not on the center of screen, little to the left looks cool to me) and fire the bullet from muzzle bullets will still came out at an angle but player won't be able to notice it(I tested it and it looks totally okay, even with centered crosshair). \$\endgroup\$ – Daniyal Azram Jun 3 '16 at 12:27
  • \$\begingroup\$ I am trying to draw the crosshair in the center and orienting the hands little up so the gun's muzzle and crosshair are perfectly aligned and shooting from muzzle will hit the correct target. \$\endgroup\$ – Daniyal Azram Jun 3 '16 at 12:30
  • \$\begingroup\$ Yes, I am a Halo fan :) I think firing bullets from weapons works best in third-person shooters, and in FPS with non-hitscan weapons, like a rocket launcher or a nail gun. On the other hand, bullets shot from weapons keep the game realistic, although the player may be forced with right-handed weapons. \$\endgroup\$ – liggiorgio Jun 3 '16 at 12:39
  • \$\begingroup\$ With the latter strategy, the answer to your linked question is fine: hitscan from the camera, find the point player is looking at, then fire bullet from weapon towards that point. There may be other obstacles along the trajectory, which is absolutely fine in my opinion. Firing bullets from the weapon works fine with laser pointer as an alternative to HUD crosshair too. \$\endgroup\$ – liggiorgio Jun 3 '16 at 12:41
  • \$\begingroup\$ Shooting from the muzzle makes it more realistic(and hard to achieve too), I don't know I might end up shooting from the camera anyways thanks for the answer. I think its just design choice or personal preference when it comes to drawing crosshair. (How come I never played any Halo game, fact is I always thought Halo series is xbox exclusive). \$\endgroup\$ – Daniyal Azram Jun 3 '16 at 12:45
1
\$\begingroup\$

Posting an answer to point out that there are other options.

In some games (though I can't think of specific titles right now) you may notice the crosshair is projected out from the weapon's line of fire, similar to a laser sight. This is highlighted when you walk up to a wall and the crosshair moves dramatically, because the weapon barrel is far closer to the wall and therefore the offset is more noticeable. I imagine most VR first-person games with crosshairs would use this effect, but some non-VR games do too. This technique would make the crosshair accurate because it's projected from the weapon.

I'm not sure if this technique is used in many games, but you could also have the weapon's firing angle adjust to the place that the crosshair is aiming - Project the crosshair straight out from the camera, and then adjust the weapon's displayed angle and aiming direction to point at the place the crosshair has 'hit'. This would mean that the crosshair becomes accurate by virtue of it being the target point for the weapon. You may want to have some boundaries for the weapon's angle though, so it doesn't angle itself so

\$\endgroup\$
  • \$\begingroup\$ This is a nice alternative, though a bit expensive: draw the weapon, raycast from the barrel, detect the end point, convert space coordinates into screen coordinates, finally draw the crosshair. I remember Splinter Cell Pandora Tomorrow, where the SC20K rifle let you choose between GUI crosshair and laser aim: the laser was an actual 3D object, so that you could see where your weapon was actually aiming at. Other games use the laser aim tecnique too, I agree. \$\endgroup\$ – liggiorgio Jun 8 '16 at 9:43
  • \$\begingroup\$ In the start when I first tried to draw crosshair I actually did the same, draw it to the forward of the gun's tip but with walking animations or headbob the crosshair was acting weirdly like moving up and down as weapon goes up and down. In almost every fps you will notice that crosshair has nothing to do with movement and would stay still. \$\endgroup\$ – Daniyal Azram Jun 8 '16 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.