I am trying to convert the LOC/ROT/SCALE information contained in the .co property of each particle into a matrix_world compatible matrix. The result of such conversion would result in an object being placed at the same position and orientation as the original particle.
I have some code to fetch the .co properties. But I am stuck on how to convert to a matrix?
import bpy def valid_particle(pa, cfra): return not (pa.birth_time > cfra or (pa.birth_time + pa.die_time) < cfra) def returnSampledParticles(scene, psys): loc =  rot =  size =  birth =  death =  for p in psys.particles: if valid_particle(p, scene.frame_current): loc.extend( p.location ) rot.extend( p.rotation ) size.append(p.size) birth.append(p.birth_time) death.append(p.die_time) return (loc, rot, size, birth, death) ob_emitter = bpy.data.objects.get("emitter") scene = bpy.data.scenes psys = ob_emitter.particle_systems samples = [returnSampledParticles(scene, psys)] # This def takes longer the larger the particle count. # Loop through the particles. for loc, rot, size, birth, death in samples: # Here is where I am stuck. # Are particle rotations quaternion? matrix_particle = ob_emitter.matrix_world * returnMatrix(loc, rot, size) # What would returnMatrix code look like?