Raycasting is a method of plotting the trajectory of in-game items, like bombs, lasers, explosions, and bullets. Though it isn’t entirely necessary to make a successful game, certain users have found ways to leverage the system to create innovative gameplay mechanics. We thought we’d explore the concept by talking to Daxter33, creator of the ever-popular Paintball!
Here’s how raycasting works: every weapon that features projectiles has a trajectory or, more simply, a path to travel. When you shoot a gun with instantaneous speed projectiles (as opposed to guns with slower projectiles that are physically simulated objects), you create a vector, which is determined by finding the gun in 3D space, the point it’s going to hit, and subtracting the two. Basically, you find a direction for your bullet to travel. A raycast can determine that path for you, as well as identify objects that appear in the path of the traveling bullet. You’re tracing a beam of light through 3D space.
Continue reading