Check for Collision BETWEEN objects?



Um... the title may be misleading. I'm not new to Gamemaker in any way. In fact, I've been using it since GM 7.0, but today I came across a problem.

Does anyone know how to check if there's a solid object in between two objects? So like this:


So say those letters are objects, right? (ignore the underscores)

Is there a way I could check if there were any objects in that distance between them? It'd be great if there was a simple way to, but I can't come up with anything. The only idea I do have is to have one object send an invisible projectile towards the other, and if it hit anything that would tell me, but that takes time, and I couldn't do that several times a second.

Any help would be appreciated.



As I am actually playing with collision_line, I'd like to know how you've managed to implement it? Have you put it in the step event using previous coordinates and actual coordinates or futur coordinates?

In my case, I'm trying to check if an object is going through a wall at high speed. (so in one step the object is before the wall and next step as the speed is very high the object is after the wall so no collision have occured) For now, I've been able to detect it, but only on the step after he've gone through the wall, and I'm trying to reverse his movement and stick to the wall.

So in my step event I have this:

if(collision_line( xprev, yprev, x, y, object_rouge, true, false ))
        x = xprev;
        y = yprev;
    move_contact_all(direction, 0);
xprev = x;
yprev = y;
But the result is that the object stay stuck after the wall and not before, and I've no idea why :s