I’ve set up a small mostly AS 2.0 particle engine, its pretty neat. My one problem is this: I want to make them hitTest walls/floors. I can do the actual hitTests just fine, the problem is that at a low velocity they just get stuck within the walls/floor, and just fall through slowly. Is there any good way avoid this?
Note: I am essentially remaking the engine in my signature in AS 2.0.
Yes, that may happen when the intersecting regions of the object and wall/floor is greater than the object’s current velocity.
To get around that problem I normally use if else statements rather than hitTest, or you should check if the ibject will collide the wall before assigning it’s new position. Do you see where I’m getting at?
// This is just for the x axis.
// Provided that the registration point of the particle (ball) is at the center.
if((ball._x + ball._width/2 > wall._x) || (ball._x - ball._width/2 < 0)) {
change speed of the particle
}
check for each wall individually (not hittest). Then, when past one, re-position the partical to be completey out of that wall to prevent getting stuck.
The problem is… I want to be able to hitTest a freeform movieclip, not defined walls; If I check for when it will hit, at high velocities it bounces in midair, because the difference between its current x/y is so different from its projected x/y. Any magic solutions or will I just have to limit my velocities?