Fussball3D: 2D Collision Logic

balls

So how did I create the 2D logic for the Fussball demo? The answer is quite simple really. The foot of the player can connect with the ball only if the foot is at the right distance from the table, right? Because the player rotates, it can only hit the ball if the foot is pointing down. In the code I implemented this logic like this:

Read More

Fussball: 3D Game Scene #4

in away3d and isgl3d

For my fourth 3D Game Scene tutorial, using 2D collision logic for 3D games, I went ahead and created a Fussball game using a surprisingly simple system of collision. The game of course makes little sense without support for multi-touch, but I’ve included an Away3D version just the same.

Read More

Moon Herder: Grid Collision

the stars

In Moon Herder I can have up to 450 stars on screen. I need to update them because I want to make them blink and rotate randomly, and I also need to run collision detection with them. Only an idiot would iterate over 450 indexes inside the game’s main loop, while randomly selecting indexes and checking distances… So I used a grid. And here’s how.

Read More

Moon Herder 2.0: Line Collision

oh, no... math!

So far in this blog, if you ignore physics engine logic, I think I’ve talked about two methods for point-line collision: your run-of-the-mill rule of three method, and the straight line equation method. Each has its place in the world, its pros and cons… For the original MoonHerder game I used a mix of the two.

Read More