by Annie | Mar 30, 2011 | Game Design
Creating a full game for the first time no doubt brings about surprises. But one surprise I didn’t expect was having to dig up the little high school trigonometry knowledge I’d long ago buried in the deep recesses of my brain. So dust off the cobwebs and come along for the ride. Here’s your daily dose of vector math. Aim Assist Ball In the process of designing ball powerups for our game, we decided to add an aim assist ball that would show players the trajectory of the ball, as well as the first deflection, allowing players to line up their shots more accurately for long shots. The task of programming this nifty little powerup fell to me. Ball Physics To start, I looked at the ball physics of classics like Pong and Arkanoid, analyzing the angles of deflection and trying to figure out the patterns. Soon, it was time to get out the graph paper and start plotting points. In order to show the trajectory, I would need to know the initial angle the ball was aimed. In order to figure out the angle of deflection, I would need to figure out the orientation of the surface the ball would hit, as well as the angle of the collision. After plugging and chugging several sets of numbers and angles, I finally realized the common thread. So for those of you still hoping to create a Pong game of your own, here’s the anatomy of ball deflection. Hit Normal First and foremost, we need to figure out the orientation of the surface the ball hits. Is the surface vertical, horizontal,...