Shooting Targets in Augmented Reality
There are a lot of different ways to play shooter games. You can play Call of Duty on your console, run SuperHot on a VR headset, or even paintball. These are all some really cool ways to simulate the thrill of a shooter game.
Unfortunately, console games aren’t extremely realistic, VR limits where you can physically move around, and paintball isn’t exactly conveniently available to play whenever you want.
Augmented reality (AR) introduces a way to turn your physical environment into a shooting range, or competitive arena.
To prove this concept I used Apple’s ARKit 3 to create an AR app that lets people place virtual targets anywhere in their environment and shoot at them with little virtual pellets.
Here’s a demo of the app!:
How the App Works
When you start up the app, the camera analyzes the area you are in and establishes a world origin. The origin will be where the camera is. This origin is used to give objects a quantitative location in the world. The location will be measured by its distance from the origin
When the user clicks the “add targets” button, the app uses the world origin as a reference to place 3 egg-shaped targets in front of the camera.
Whenever the user taps on the screen, the app generates a small red pellet to shoot at the targets. It’s given a physics body so that it is affected by gravity. But since it’s launched with an extremely high velocity, there isn’t much vertical drop.
Both the targets and pellets are given collision bodies that look for each other. So basically, if the 2 objects ever collide, the collision bodies check to see if they collided with each other. If they did, a collision is registered and the target explodes in flames using a cool particle effect.
This is a super basic proof of concept. Imagine having virtual holograms running around your house to play games with. This would be sick for people to enjoy for fun or even for police to conveniently practice drills!
If You Enjoyed this article:
- Follow me on Medium and connect with me on LinkedIn to stay updated with my work!
- Subscribe to my newsletter to follow my journey!:
Shooting Targets in Augmented Reality was originally published in AR/VR Journey: Augmented & Virtual Reality Magazine on Medium, where people are continuing the conversation by highlighting and responding to this story.
Discover Past Posts