# Class: particlesys

ParticleSystem contains of dynamic particles, which spawn at emitters and die after a given time. The way they move and appear is controlled by the particlescript, which has its own detailed manual. All particles of a system are rendered at the end of a l3dset and a particlesystem can be used in only one l3dst. If you want to use the same particlesystem in multiple l3dsets, use one forceload per l3dset.
Compared to ParticleClouds you cannot control particles individually.

## Hierarchy

    o-+ resource
      o-+ particlesys

## Interfaces:

- hashid
- matobject

## Methods:

### Method overview:

- bbox
- checkmax
- checkmin
- checktype
- clearparticles
- colormul
- defaultpath
- drawlayer
- forceinstance
- forceload
- getforceid
- getrestype
- intercolor
- interrot
- intersize
- intertex
- intervelocity
- lightmap
- lightmapmatrix
- load
- nodraw
- nogpu
- particlenormal
- pause
- probability
- probabilityfadeout
- sizemul
- timescale
- usecolormul
- useprobability
- usesizemul
- usevolume
- useworldaxis
- visflag
- volumecaminfluence
- volumedistance
- volumeoffset
- volumesize
- worldaxis

bbox (model,[float minx,miny,minz, maxx,maxy,maxz])
  returns: ([float minx,miny,minz, maxx,maxy,maxz])
  returns or sets bounding box
checkmax (particlesys,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets maximum of the check boundingbox.
checkmin (particlesys,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets minimum of the check boundingbox.
checktype (particlesys,[int])
  returns: ([int])
  returns or sets what kind of axis aligned bounding box check should be done. Only particles within the box (defined by checkmin/max) are drawn. Checks performed are:
  1 = x-axis
  2 = y-axis
  3 = x,y-axis
  4 = z-axis
  5 = x,z-axis
  6 = y,z-axis
  7 = all axis
  any other value = no check (default)
clearparticles (particlesys)
  returns: ()
  deletes all active particles
colormul (particlesys,[float r,g,b,a])
  returns: ([float r,g,b,a])
  color multiplier applied when usecolormul is true. Make sure to call this after interpolatercolors are set.
defaultpath ([string])
  returns: ([string])
  returns or sets the default resource path. Luxinia will search in those when resources are not found.
drawlayer (particlesys,[l3dlayerid])
  returns: ()
  at the end of which layer it will be drawn, l3dset info is ignored.
forceinstance (particlesys,[boolean])
  returns: ([boolean])
  will use instancing rendering even for the small normally batched billboards
forceload (string filename,[int sortkey])
  returns: (Particlesys psys)
  forces load of a particlesystem. If the same file was already loaded before, this will create another copy of it.
getforceid (particlesys,string name)
  returns: ([particleforceid])
  returns particleforceid if found.
getrestype ()
  returns: (int restype)
  returns the resource type as int value, useful for resdata or reschunk functions
intercolor (particlesys,int step (0..127),[float r,g,b,a])
  returns: ([float r,g,b,a])
  returns or sets the color at the particle interpolator step.
interrot (particlesys,int step (0..127),[float])
  returns: ([float])
  returns or sets the rotation multiplier at the particle interpolator step.
intersize (particlesys,int step (0..127),[float])
  returns: ([float])
  returns or sets the size multiplier at the particle interpolator step.
intertex (particlesys,int step (0..127),[int])
  returns: ([int])
  returns or sets the texturenumber at the particle interpolator step.
intervelocity (particlesys,int step (0..127),[float])
  returns: ([float])
  returns or sets the velocity multiplier at the particle interpolator step.
lightmap (particlesys,[texture])
  returns: ([texture])
  lightmap texture to be used. for texture coordinates the world space positions are transformed with lightmapmatrix
lightmapmatrix (particlesys,[matrix16])
  returns: ([matrix16])
  generates texture coordinates when lightmap is used.
load (string filename,[int sortkey])
  returns: (Particlesys psys)
  loads a particlesystem
nodraw (particlesys,[boolean])
  returns: ([boolean])
  wont draw the system
nogpu (particlesys,[boolean])
  returns: ([boolean])
  wont use the default gpu programs
particlenormal (particlesys,[boolean])
  returns: ([boolean])
  will use particle's normal. Only applied when instancing renderpath is used.
pause (particlesys,[boolean])
  returns: ([boolean])
  will not perform any updates to the particles
probability (particlesys,[float])
  returns: ([float])
  percentage of how many particles are rendered when useprobability is true
probabilityfadeout (particlesys,[float])
  returns: ([float])
  fadeout threshold. when particle's render probability is between probability-thresh its color alpha will be interpolated accordingly. The more it closes the probability value the less its alpha will be.
sizemul (particlesys,[float])
  returns: ([float])
  size multiplier applied when usesizemul is true
timescale (particlesys,[float])
  returns: ([float])
  you can slow down or speed up particle update and aging. 1.0 is default
usecolormul (particlesys,[boolean])
  returns: ([boolean])
  if set output colors are multipiled with colormul
useprobability (particlesys,[boolean])
  returns: ([boolean])
  if set not all particles are drawn but user given percentage
usesizemul (particlesys,[boolean])
  returns: ([boolean])
  if set output size is multiplied with sizemul
usevolume (particlesys,[boolean])
  returns: ([boolean])
  particles are kept in a box volume, and treated as infinite distribution
useworldaxis (particlesys,[boolean])
  returns: ([boolean])
  when set the billboards will be aligned with the user given world axis and not face camera.
visflag (particlesys,int id,[boolean])
  returns: ([boolean])
  sets visibility bit flag, default is true for id 1 and false for rest. It is bitwise 'and'ed with camera bitid to decide if particles should be drawn.
volumecaminfluence (particlesys,[float x,y,z])
  returns: ([float x,y,z])
  how much the camera position affects the volumecenter (default is 1,1,1).
volumedistance (particlesys,[float])
  returns: ([float])
  distance from volume center to camera
volumeoffset (particlesys,[float x,y,z])
  returns: ([float x,y,z])
  the position that is used when volumecaminfluence is 0
volumesize (particlesys,[float x,y,z])
  returns: ([float x,y,z])
  size of the volume
worldaxis (particlesys,[matrix16])
  returns: ([matrix16])
  the user given align matrix for all billboards when useworldaxis is true. It will remove the camrotfix flag as it is unneeded.

## Inherited Methods:

### From resource

condition, getresname, getresshortname