"blind" hitTest?

hi everyone,

i’m a new member of the Kirupa community, french developper (php/js/html/flash). So, pleased to be here :p:

here is my huge pb of the day:
I’m working on a pseudo-IA. On a defined area, I duplicate x clip (particles). Each particle, once created, move by itself (randomized movements inside the area). Naturally I want that particles interact between themselves. The point is : how to know if 2 particles bump ?
It’s driving me totally crazy since this morning :d: because I can’t make a hit test on each particle beacause each particle is moving on each enterFrame.
So if I had 30 particles, i’d be obliged to test 29 others particles on each, so it’ll make 29*29 hitTest on each enterFrame :skull: I don’t think it’s the right way to do it…
i’would be thankfull for new ideas …
:bu:

a+
julien_neo

hm…welcome to the forums, first off.

i really can’t think of anything. i was going to suggest having each particle push it’s coords into one array (of 30 elements) and at the same time check the others if they are within proximity, but that’s pretty much the same thing as hitTesting each time…

yep that’s what i’m doing, that’s what I used to do anyway: put in 3 arrays the x,y and z position of each particle but putting a function testing position on each particle is a real mess. The solution might be in a global function that runs on a global enterFrame (not one by particle) but it’s quite a mess too…
I hope the night would be helpfull (it’s to to bed for me in france…) or maybe kirupa members :beam: …

lol, you’re doing this in 3D??? 2D is bad enough. Here’s something you might consider for efficiency’s sake:

Make one array with n number of elements (same # as particles) and just have each element be an object with vars x, y, and z.

Storing coordinates is a pain, I know.