An Elaborate Example

Let's develop the spatial hash grid broad phase based on our last cannonball example. We will completely rework it to incorporate everything covered in this section so far. In addition to the cannon and the ball, we also want to have targets to fire at. We'll make our lives easy and just use squares of size 0.5x0.5 meters as targets. These squares don't move; they're static. Our cannon is static as well. The only thing that moves is the cannonball itself. We can generally categorize objects in our game world as static objects or dynamic objects. So let's devise a class that can represent such objects.

0 0

Post a comment