[FMX] Math-based collision prediction -- I need some help

For the physics engine I’m developing, (Flash MX) I need it to be able to handle particles moving quickly enough that hitTest() would be impractical because of clipping issues. I’m representing particle movement through vectors, and in each frame I update the position of particles based on their physics vector. I’m trying to design a collision detection system that detects whether the line representing the particle’s vector intersects a movie clip, and where on that line it does.

This way, I can figure out exactly if and where a particle will collide on the next frame without having to worry about it clipping. Problem is, I can’t exactly tell the engine to parse every point along the line and check for collisions using hitTest; that would be too processor-intensive and would kill my framerate (I’m shooting for 24 or 30 fps.) Any good ways to tell if a line intersects an irregularly-shaped movie clip on the fly? Thanks a LOT.

Really. I’ve been working on this without success for months…

hm, how about you hittest on one or two points in front of your particles (about 10 or 20 pixels in front)? The first one for a nice headstart warning, the second for fast moving objects, and the actual particle ofcourse. As soon as one of your scouts detects an object it hits on, add the reference to an array you hittest on for every frame to come. Up until you’ve past the object. That should be a pretty efficient way to hittest for stuff.

Add more ‘scouts’ in front of your particle the faster you move it for increased accuracy.

oh wait… the object you added in the array for things that might hit your particle mustn’t be hittested, but instead use it’s x, y, width and height to accurately predict a collision.