When I began my new project, the first gameplay mechanic I attempted to make was a first person weapon firing. From my knowledge of shooter games, I knew that I could choose from two main categories of firing:
- Hitscan: As soon as the player presses the fire input, the target in their crosshairs is hit instantly.
- Projectile: When the fire input is pressed, a projectile is fired from the weapon, travelling in the direction of the destination in the crosshairs.
To investigate this, I looked into the game Overwatch, as I knew there were some hitscan weapons and some projectile weapons and I wanted to look into exactly how it worked. Below is an example of the firing system for the character Baptiste, who has a hitscan fire to deal damage to enemies and a projectile fire to heal teammates.
What this video shows is that, for both hitscan and projectile fire, the shot reaches its target, regardless of whether it logically looks to the player like it should. If the player stands behind a wall, so there is an obstruction between them and the location indicated by the crosshair, they can still hit that location. The way I think this works is that two things happening with each shot. For hitscan fire, the hit is detected at the location of the crosshair, and the visuals are drawn between the player and the target. For projectile fire, a projectile is launched from the player camera to the target. I think the way this works is by using separate actors for collision and visuals. For hitscan, the target is damaged when the players fires, and some form of visual show the player's bullet movement. For projectiles, a colliding projectile is fired and a separate visual element is moved from the fire point of the weapon but to the same destination as the collider.
There is second type of projectile that must be accounted for, which is demonstrated by the character Junkrat. He fires a grenade that bounces off walls and floors. For this type of projectile, it would not work as a collision projectile and a visual to go with it, as the visual would behave unpredictably on bounces. Instead, I think these projectiles are fired directly from the fire point of the weapon and only consist of a single actor containing collision and visuals, instead of two separate ones.
Comments
Post a Comment