Wednesday, December 14, 2011

Simple 2D collision detection?

I've started working on a simple RTS game, written in C with Cairo on top of SDL. One of the parts of my design is to eliminate the grid that units usually stand on. In order to do this, I have to do collision detection between units constantly. Each unit acts like a perfect circle in terms of collision, so it's not too hard to calculate if two units are colliding. I've yet to implement this, but it seems like it would be very slow and not scalable to check all possible collisions every frame, so I'm uming some other technique is usually used. Does anyone know how collision detection is usually implemented in this cirstance? Or is it just impractical to eliminate "the grid"?.

0 comments:

Post a Comment