Notifications
Clear all

[Closed] birth script problem

hello all… having some problem with a birth script in PF. I am trying to generate particles on the vertices of a mesh, and have them generated over time. here is the basic part of the script:

on Proceed pCont do 
 (
 
 	t1 = pCont.getTimeStart() as float
 	t2 = pCont.getTimeEnd() as float
 	local theMesh = snapshotAsMesh $Shape01
 	local theCount = theMesh.numverts
 
 	if (t1 < 0) then (t1 = 0) 
 	
 	if (t2 < theCount*160) do
 	(
 
 		for i in (t1/8+1) to (t2/8) do
 		(
 			curTime = 8*i as float
 			pCont.AddParticle()
 			pCont.particleIndex = pCont.NumParticles() 
 			pCont.particleTime = curTime/160
 			pCont.particleAge = 0
 			local theNormal = getNormal theMesh i
 			if theNormal == [0,0,1] then
 			(
 				theMatrix = matrix3 1
 			)
 			else
 			(
 				local theUpVector = [0,0,1]
 				local theXVector = normalize (cross theNormal theUpVector)
 				local theYVector = normalize (cross theNormal theXVector)
 				theMatrix = matrix3 theXVector theYVector theNormal [0,0,0]
 			)
 
 			theMatrix.row4 = getVert theMesh i
 			pCont.particleTM = theMatrix
 		)
 
 	delete theMesh
 
 	)
 )

Now, everything works fine, except that at certain vertices the particles are not generated. More specifically at vertices with index number 512, 1024, 1536, 2048 etc…When I change t1/8+1 and t2/8 into something like t1/6+1 and t2/6 or any other number in the place of the 8, the pattern of empty vertices changes (and I get far more empty ones…)
well… any ideas???
thanks…