gskinner's code is the part that requires the acknowledgement, but the algorithm isn't his. So make your own version. Or just suck it up and us gskinner's class. My reading of the comment in the file is that you just need to keep his info in the class file - not that you have to give on-screen credit. But maybe I'm wrong on that...?
Or like I said in one of your earlier posts you have a lot of hard learning to do. This isn't an easy problem so there are no easy solutions. The polygonal.de website has a lot of great stuff about all kinds of collision detection.
And whatever happened with the bitmap data class approach? That seemed really promising.
It took too much of the processor.
You mean the bitmap data hittest method took too much processor power?
Without knowing all your details it is hard to tailor an exact system and how it should work. So here is somewhat of how I would do it.
I am assuming that you are trying to check if many things are hitting many other things and that the shapes, while irregular, are not wildly divergent from their bounding box. (In otherwords that they are neat shapes that are at least close to their bounding box, perhaps filling some 70% or so.) And I'm also assuming that they are not complex paths, e.g., not a doughnut/torus.
- Be sure to use a double loop that only tests the correct number of pairs. So if there are n items you will need n*(n-1)/2 trials. NOT n*(n-1). Very important here. Of course even this approach is a bit inefficient, and you could try the RDC algorithm (http://lab.polygonal.de/articles/recursive-dimensional-clustering/) But for smallish numbers of items the first approach is probably suitable.
- Use the basic bounding box hittest on all the pairs. For the pairs where there is a hit at that level put them in an array for further processing. This test is fairly quick and there is no point using a more expensive test on each pair. (As to the above RDC, I haven't read the whole thing closely for awhile, so this step might already be part of that algorithm)
- Take that array and use one of the other methods like the bitmap hittest or some version of the same algorithm of gskinners.
Did you do all three of these things together or just #3? I don't know exactly how much speed you need, but some combination of these things should work fairly well.
I'm still not really clear on why you don't want to use gskinner's class. Have you tried it and does it provide enough speed? Did you try kglad's method? Did it provide enough speed? I don't think either of those people would mind you trying out their algorithms to learn from -- just to see what is possible. (Sorry if I'm misrepresenting you there kglad! I plan to go back and find that bit of code just to see what clever tricks you are up to. )
If you can't get enough speed with those algorithms, then how are you sure that is where the problem lies? Maybe there is something else that is sucking cycles? Just a thought.
The other choice is to simplify some of your shapes to circles or other regular shapes.
Oh and one more thing. AS3 is much faster, so if you are really needing speed you might want to think about using it.
RothRock, thank you so much, for your answer.
I tried to use, the bitmapData.hitTest(), drawing a bitmap every 10 milliseconds.
This, because I was having to use nested movieclips, because the movieclip
inside the main movieclip had to rotate.
For now, I´ll read all your post, and
see what I can do.
I can´t use gskinner´s class, because I can´t put the comments needed to
mention credits to gskinner.
Ah, when I said irregular shapes I meant like very irregular, with curves
These shapes are simple draws.
I´m very greatful ).