How do games like Call of Duty, Battlefield and Wolfenstein: the New Order do their ironsights? Do they just align the model or is it an image?
2 Answers
You can use a model. Often, HUD elements, sometimes including weapons, are rendered seperately from the environment. In the simplest example you'd set up the animation so that the ironsights line up with the zero-axis, and align the model's zero axis with the camera.
Using Unity as an example, you'd put the weapon in the HUD layer so that it's drawn with a camera that only draws the HUD layer.
Alternatively, you can set up the player avatar so that it lines up the same way, using the same camera. This has the added benefit of displaying to other players what you're doing without having to make a separate model, but re-positioning the gun with respect to the camera can be fiddly.
Of course, it's possible to use an image as well. If memory serves, TF2 uses a combination of these - with the sniper rifle animation leading into a sprite overlay with the sights dead center of the screen.
-
1\$\begingroup\$ Battlefield 2, for example uses images. But again, it's a rather old game, where the lack of lights on the image wouldn't be as noticeable as in current games. \$\endgroup\$– KroltanCommented Jul 12, 2015 at 16:41
-
1\$\begingroup\$ Other aspects to using the model include FOV and image effects. Decreasing the FOV as the model comes closer to the player can simulate "zooming" in. And when zooming in on a model's iron sights, even something as simple as bumping up an existing DOF screen effect can go a long way in simulating parts of the the weapon going "out of focus" as they're brought up to the character's face. \$\endgroup\$ Commented Jul 12, 2015 at 18:11
Both ways, but the model is more common in modern games
Only a few games use an image, the majority use a model and align the model to the centre of the screen.
This blog post gives much detail on the various systems, including ones not mentioned in the OP Aim systems in First Person Shooters
-
\$\begingroup\$ Oh yeah and another thing with models, when your character zooms in, is that a type of animation (like shooting and reloading) or is it something else? \$\endgroup\$– KBitCommented Nov 2, 2015 at 8:26