# Class: l3dpgroup

list3d node of a particle group. The group can contain manually spawned particles, which will not perform any additional movement unless user changes them. The particles are transformed with the groups matrix in local types, also the renderscale is applied. There is 4 different types of particlegroups, only local/world allow manual spawning. All particles of the same particlecloud will be rendered at once, to optimize performance you should use as little particleclouds as possible. You can tweak particles appearance individually or update them all in one batch. When they spawn they will get default values, to assign those use 0 as particle in the prt??? functions, to update all particles' attributes you can pass 1 as particle.
Automatic particlegroups, such as typeworldref,typemodelvertices,typemodelbones remove their particles when references become invalid.

## Hierarchy

    o-+ l3dlist
      o-+ l3dnode
        o-+ l3dpgroup

## Methods:

### Method overview:

- autorot
- autoscale
- autoseq
- colorvar
- drawlisthead
- drawlisttail
- getfirst
- getparticlecloud
- new
- particlecount
- prtColor
- prtNext
- prtNormal
- prtNormalworld
- prtPos
- prtPosworld
- prtPrev
- prtRotangle
- prtSeq
- prtSize
- prtSwap
- remove
- removemulti
- rotvar
- sizevar
- spawn
- spawnworldref
- typelocal
- typemodelbones
- typemodelvertices
- typeworld
- typeworldref
- updatetoworld
- usecolorvar
- usedrawlist

new (string name,|l3dlayerid layer|,particlecloud)
  returns: (l3dgroup)
  new particle group l3dnode. The layer itself isnt important but the l3dset is extracted from it. Particlecloud has a command to define in which layer it should be rendered.
autorot (l3dgroup,[float])
  returns: ([float])
  gets or sets automatic rotation in radians per second. Set to 0 to disable.
autoscale (l3dgroup,[float])
  returns: ([float])
  gets or sets automatic scaling add per second. scale = scale + (autoscale/second)*time
autoseq (l3dgroup,[float])
  returns: ([float])
  gets or sets automatic sequencing, time in ms until the next texid is used, simply loops thru seqeunces in the texture. 0 to disable
colorvar (l3dgroup,[float r,g,b,a])
  returns: ([float r,g,b,a])
  gets or sets color variances. outvalue = random [in-variance,in+variance]
drawlisthead (l3dgroup,[particle])
  returns: ([particle])
  gets or sets particle that serves as head of the drawlist when usedrawlist is enabled. Be aware that there is no error checking if the particle really belongs to this group, you will get undefined behavior if you assign particles from other groups.
drawlisttail (l3dgroup,[particle])
  returns: ([particle])
  gets or sets particle that serves as trail of the drawlist when usedrawlist is enabled. Be aware that there is no error checking if the particle really belongs to this group, you will get undefined behavior if you assign particles from other groups.
getfirst (l3dgroup)
  returns: (particle)
  returns first particle
getparticlecloud (l3dgroup)
  returns: (particlecloud)
  returns particlecloud of group.
particlecount (l3dgroup)
  returns: (int)
  returns current particle count of the group.
prtColor (l3dpgroup,particle,[float r,g,b,a])
  returns: ([float r,g,b,a])
  gets or sets particle color. particlecloud must have particlecolor flag set to make it use the value.
prtNext (l3dpgroup,particle)
  returns: (particle)
  returns next particle or null if last. useful for manual iteration.
prtNormal (l3dpgroup,particle,[float x,y,z])
  returns: ([float x,y,z])
  gets or sets particle normal, does not allow 'set all'.
prtNormalworld (l3dpgroup,particle)
  returns: ([float x,y,z])
  gets or sets particle normal. Make sure to call l3dpgroup.updatetoworld, else positions might not be uptodate.
prtPos (l3dpgroup,particle,[float x,y,z])
  returns: ([float x,y,z])
  gets or sets particle position, does not allow 'set all'
prtPosworld (l3dpgroup,particle)
  returns: ([float x,y,z])
  gets or sets particle world position. Make sure to call l3dpgroup.updatetoworld, else positions might not be uptodate.
prtPrev (l3dpgroup,particle)
  returns: (particle)
  returns prev particle or null if first. useful for manual iteration.
prtRotangle (l3dpgroup,particle,[float])
  returns: ([float])
  gets or sets particle rotation in radians. particlecloud must have rotate flag set to make it use the value.
prtSeq (l3dpgroup,particle,[int])
  returns: ([int])
  gets or sets particle sequence number, the subtexture to be used if we have a sequencecount greater 1.
prtSize (l3dpgroup,particle,[float])
  returns: ([float])
  gets or sets particle size.
prtSwap (l3dpgroup,particle,particle)
  returns: ()
  swaps content of the two particles.
remove (l3dgroup,particle)
  returns: ()
  removes the particle, but performs no error checking, so any l3dpgroup could have spawned it belonging to the same particlecloud.
removemulti (l3dgroup,string cmds, ...)
  returns: ([int count])

  removes multiple particles that fulfill all commands.
  The command string specifies what should be compared, and after the string each compare function has a different set of arguments:

  1. 't': seqeunce texid (comparemode,int)

  2. 'd': distance to point (comparemode,float x,y,z,distance)

  3. 's': size (comparemode,float)
  e.g. grp:("td",comparemode.greater(),1,comparemode.less(),1,2,3,100)
  kicks all particles with texseqid greater than one and with distance to point(1,2,3) less than 100.
rotvar (l3dgroup,[float])
  returns: ([float])
  gets or sets rotationangle variance for spawned particles. outvalue = random [in-variance,in+variance]
sizevar (l3dgroup,[float])
  returns: ([float])
  gets or sets size variance for spawned particles. outvalue = random [in-variance,in+variance]
spawn (l3dgroup,float pos x,y,z,[float normal x,y,z])
  returns: (particle)
  spawns a single particle, depending on the l3dpgroup type either in object coords or local coords. It will get the default particle values, to set those just pass 0 as particle in the prt??? functions.
spawnworldref (l3dgroup,[actornode]/[scenenode],int axis)
  returns: (particle)
  spawns a single particle that is autolinked to the given node. Axis is 0(X),1(Y),2(Z) and will mark the axis used for normals. Particle uses default values for the rest.
typelocal (l3dgroup)
  returns: ()
  sets the grouptype to LOCAL, particle coordinates are in localspace
typemodelbones (l3dgroup,l3dmodel,int axis,stringstack)
  returns: ()
  sets the grouptype to LOCAL, particle coordinates are in localspace and taken from the l3dmodel's bonesystem. Axis is 0(X),1(Y),2(Z) and will mark the axis used for normals, stringstack allows up to 128 items. To make sure the bones are updated before the particle group is activated and that their positions match, link the group as children to the l3dmodel.
typemodelvertices (l3dgroup,l3dmodel,meshid,float percent)
  returns: ()
  sets the grouptype to LOCAL, particle coordinates are in localspace and taken from the l3dmodel's vertices. You can specify how many percent of the mesh's surface you want to put particles on.
typeworld (l3dgroup)
  returns: ()
  sets the grouptype to WORLD, particle coordinates are in worldspace
typeworldref (l3dgroup)
  returns: ()
  sets the grouptype to WORLD_REFERENCE, particle coordinates are in worldspace, and auto linked to actornode or scenenode.
updatetoworld (l3dgroup)
  returns: ()
  transforms all particles to world state, using the current worldmatrix of the l3dpgroup. Can be useful if manual manipulation of the particles needs to be done.
usecolorvar (l3dgroup,[float])
  returns: ([float])
  gets or sets if colorvariance is used for spawned particles.
usedrawlist (l3dgroup,[particle])
  returns: ([particle])
  gets or sets if the manual drawlist should be used. You specify the list of particles that should be drawn with the drawlisthead/tail commands.

## Inherited Methods:

### From l3dnode

cambox, camsphere, camvolumedelete, color, delete, isanimateable, lastframe, lightmap, lightmaptexmatrix, linkinterface, localmatrix, localpos, localrotaxis, localrotdeg, localrotquat, localrotrad, name, novistest, parent, parentbone, renderscale, rotationlock, setlayer, unlink, unparentbone, uselocal, uselookat, usemanualworld, visflag, worldmatrix, worldpos, worldrotaxis, worldrotdeg, worldrotquat, worldrotrad

### From l3dlist