Accurate Shooting - Keith Babcock
The Problem:
In a third person shooter, a common problem to solve is how can you provide the player with the accuracy of shooting from the first person where you simply have to point the gun at what you want to hit, and then shoot, while the actual position of that gun is constantly in flux, moving wherever the player is regardless of the framing of the camera. In our game, the tip of the gun is almost never pointing at the actual crosshair in the center of the screen due to animation limitations, so how could we aim the bullet in a way that it both felt like it was actually fired from the barrel of the gun while also accurately hitting a position selected by the player in third person?
The Solution:
One half of the solution was provided by Clayton Jetton with his constant revision of the animation system to get the gun to more properly aim toward the center of the screen, but the other half was provided by me, the creator of the rifle itself, in aiming the bullet correctly regardless of the actual direction of the barrel. This is done by raycasting from the center of the camera, to the world, to get the exact point in space to fire the bullet at, then rotating the bullet based on the look rotation between the muzzle of the gun and the target position.
One issue this solution had was the raycast would sometimes hit the back of the player's head if they crossed the center of the screen, which lead to the gun firing backward into the player's head, allowing the player to accidentally shoot themselves, and with friendly fire enabled this was a big problem. The solution was just to make the raycast ignore the owning actor, so it wouldn't collide with the player if they ever crossed the center of the screen.
Plague Wardens
Obliterate for your country.
Status | Prototype |
Author | Board Gamers |
Genre | Shooter, Action |
Tags | Action RPG, Bullet Hell, Co-op, horor, pve, Third-Person Shooter |
More posts
- Hand IK With Virtual Bones in UE521 hours ago
- Spawning Logic - Antonio Roldan1 day ago
- Front-End User Experience Design - Ryan Brown1 day ago
- Editing Animations in UE5 - Clayton Jetton7 days ago
- Creating a Multiplayer Minimap - Ryan Brown8 days ago
- Enemy Targeting8 days ago
- Consistent Strike Jet Strafing Run - Keith Babcock8 days ago
- Devlog 0011 days ago
Leave a comment
Log in with itch.io to leave a comment.