Lazy Foo' Productions

Lazy Wars

Once again I fail to deliver
10/05/08 - 11:30:31 PM
But at least I have the meat of the dev blog done.

First up, I got a cleaned up version of the last collision demo I posted. I broke it up into multiple source files so you don't have to scroll over and over. If you looked carefully in the first version of the demo, you would have noticed that the code for the x and y axis are pretty much exactly the same, so in this demo I created generic tMin() and tMax() functions that work for each axis (you'll find them in Collision.cpp). In the Box's move() function, I made it so it finds the point of collision which you'll see is very easy to calculate.

I also have a demo for collision between two fast moving objects. You change the Box's starting position by clicking the left mouse button and change which one you're controlling with right mouse button. I also made the boxes behave like they did in the beta version of the demo and jump back to their starting position when a collision is detected. If you want them to move to their proper position, I have the code commented out in the move() function.

The only real change in the collision detection is that you use relative velocity between objects A and B, which you'll see Box's move() function. Now it may seem like the program is glitching when you see something like this:


But you have to think about about what's happening. There's a reason I changed the color scheme for the lines. Like before, the red box is where the collision box started at the beginning of the frame and the blue box is the projection of the box at the end of the frame. This time I had lines represent the progression from the beginning to end of its path.

How is this helpful? Notice how the box moving up has the lines really red and the box moving left has its lines really blue at the intersection. This means the box moving up already passed the area of intersection long before the box moving left did. Their paths intersect, but they intersected at different times so they never collided.

I didn't manage to finish the sketches, but I'll tell you what will be in them. They're going to detail the design for the split screen for when you want to have multiple players on one computer and the main feature they're going to detail is the ability for local players to join in at any time. So if you joined an online game and your friend comes along with a controller, you're friend will be able to plug in his control, set his keys, set his profile and join right in if there's enough space left in the room.


Dev Blog Archive