# What algorithm to use for predictive collision detection in multivariate systems?

In the collision system for my game I basically have two kinds of things, boxes, defined thusly:

struct Box2I
{
uint32_t x, y, width, height;
};


and quads, which are used for terrain:

struct Quad
{
const uint32_t left, right;
const float slope_top, intercept_top;
const float slope_bottom, intercept_bottom;
bool solid;
};


The boxes can collide with the quads, but the boxes can't collide with each other, and colliding quads has no meaning.

Anyway, I'm having trouble with the collision, the collision function should return a number between 0.0 and 1.0, where 0.0 is the time of the last frame, 1.0 is the time of the next frame--and -1 for no collision. But I can't find a way to do this.

Mostly I can find algorithms for systems such as colliding circles, where they move but the scale doesn't change, or points, etc. But I'm having trouble finding anything beyond the general scheme of: