Linking particles to objects...

Pretty self explanatory really, Ive got a series of objects (a massive amount of cubes making up a shape), and I want to spawn particles and link one particle to each object.

I can use particle flow a bit (enough to do what I want), but simply getting the distribution of the particles right to start with is going well over my head, anything I try simply doesnt work, I dont know if i’m putting the scripts in the right place or even if theyre correct.

Found this one on CG talk which a lot of people said worked very well, but its not doing shit and ive tried running it from everywhere it lets me run a script.

on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.useTM = true
pCont.useShape = true
)

on Init pCont do
(
global ChunksArray = $frag_* as array
)

on Proceed pCont do
(
t = pCont.getTimeStart() as float

if t < 0 do
(
NumChunks = ChunksArray.count
for i = 1 to NumChunks do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particleAge = 0
pCont.particleTM = ChunksArray.transform
pCont.particleShape = ChunksArray[i].mesh
)
)
)

on Release pCont do
(

) 

Any ideas as to what i’m doing wrong?

I wouldve thought this would be a fairly easy thing to do, given how common it should be. :frowning:

Well, ive got the generation working, but ive got another problem…

My particles assign to the objects fine, theyre in the correct positions, but when I display the object that theyre attached to theyre all twice the distance they should be from a center point which shouldnt even be being used anymore…

Here’s an screen to show what I mean:
Yellow = the particle objects, coloured ones are my original fragments. The particles themselves sit on the pivot point of the original objects.

Any ideas?

edit: fixed it with a workaround, shape instanced a new box the same size and it went to the correct position. Wouldnt have worked if I wasnt using cubes though…

edit2: If you happen to be in a similar situation - reset the xform on your selected objects :wink: