# Class: l3dtrail

Contains a collection of points, that are rendered as a quad strip.

## Hierarchy

    o-+ l3dlist
      o-+ l3dnode
        o-+ l3dtrail

## Interfaces:

- matobject
- renderflag
- rendersurface

## Methods:

### Method overview:

- closed
- color
- drawlength
- facecamera
- indexcolor
- indexsize
- materialnormalized
- materialscale
- matsurface
- new
- normalizedsize
- planarmap
- planarscale
- reset
- size
- spawn
- spawnstep
- spawnworldref
- tpNext
- tpNormal
- tpNormalarray
- tpPos
- tpPosarray
- tpPrev
- tpTime
- tpVel
- tpVelarray
- typelocal
- typeworld
- typeworldref
- usevelocity
- velocity

new (string name,int length,[l3dlayerid])
  returns: (trail)
  a new trail system
closed (l3dtrail,[boolean])
  returns: ([boolean])
  sets or returns if trail ends where it starts. The last added point will be skipped and the first is used instead, so add one more point than the ones you really need.
color (l3dtrail,int step,[float r,g,b,a])
  returns: ([float r,g,b,a])
  sets or returns color interpolater at step. There is 0-2 steps, step 3 or -1 sets all.
drawlength (l3dtrail,[int])
  returns: ([int])
  sets or return drawlength of trail
facecamera (l3dtrail,[bool])
  returns: ([bool])
  sets or return facecamera flag
indexcolor (l3dtrail,int step,[float r,g,b,a])
  returns: ([float r,g,b,a])
  sets or returns color at index. There is 0...length-1 steps. The regular color function creates linear interpolated values. This function lets you precisely modify every single value. However if you start using it, the regular color function will be ignored
indexsize (l3dtrail,int step,[float r,g,b,a])
  returns: ([float r,g,b,a])
  sets or returns size at index. There is 0...length-1 steps. The regular size function creates linear interpolated values. This function lets you precisely modify every single value. However if you start using it, the regular size function will be ignored.
materialnormalized (l3dtrail,[boolean])
  returns: ([boolean])
  sets or returns if the material/texture is stretched in such a fashion that its width is the length of the trail. If materialscale was applied before uscale will be applied, too.
materialscale (l3dtrail,float length, width)
  returns: ()
  sets how often a material/texture is repeated/minified. length is along x axis
matsurface (l3dtrail,[matsurface])
  returns: ([material/texture])
  sets or returns matsurface
normalizedsize (l3dtrail,[float])
  returns: ([float])
  sets or returns size of an absolute ulength when materialnormalized is used (0 disables).
planarmap (l3dtrail,[int])
  returns: ([int])
  sets or returns planar projection axis. -1 is none/disabled, 0 = x, 1 = y, z = 2. Materials will be projected along these axis.
planarscale (l3dtrail,[float])
  returns: ([float])
  sets or returns planarscale multiplier. texcoord = worldpos.projected * planarscale.
reset (l3dtrail)
  returns: ()
  clears all points
size (l3dtrail,int step,[float size])
  returns: ([float s])
  sets or returns size interpolater at step. There is 0-2 steps, step 3 or -1 sets all.
spawn (l3dtrail,float pos x,y,z,float normal x,y,z,[float vel x,y,z])
  returns: (trailpoint)
  spawns a new point in world/local coordinates, normal is needed when you dont use facecamera, and velocity when you use velocity. You can automaically spawn points with spawnstep. Illegal if typeworldref is used.
spawnstep (l3dtrail,[int])
  returns: (int)
  sets or returns spawnstep in ms, one point will be spawned every spawnstep, if spanwstep is greater 0.
spawnworldref (l3dtrail,actornode/scenenode,int axis)
  returns: (trailpoint)
  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. Only works if typeworldref is used.
tpNext (l3dtrail,trailpoint)
  returns: ([trailpoint])
  gets next trailpoint (or null).
tpNormal (l3dtrail,trailpoint,[float x,y,z])
  returns: ([float x,y,z])
  gets or sets trailpoint's position. Either local or world coordinates, depending on if trail:uselocalpoints is set.
tpNormalarray (l3dtrail,[floatarray 3t])
  returns: ([floatarray 3t])
  sets or returns normal of active trailpoints from floatarray
tpPos (l3dtrail,trailpoint,[float x,y,z])
  returns: ([float x,y,z])
  gets or sets trailpoint's position. Either local or world coordinates, depending on if trail:uselocalpoints is set.
tpPosarray (l3dtrail,[floatarray 3t])
  returns: ([floatarray 3t])
  sets or returns position of active trailpoints from floatarray
tpPrev (l3dtrail,trailpoint)
  returns: ([trailpoint])
  gets previous trailpoint (or null).
tpTime (l3dtrail,trailpoint,[int])
  returns: ([int])
  gets or sets trailpoint's spawntime in ms.
tpVel (l3dtrail,trailpoint,[float x,y,z])
  returns: ([float x,y,z])
  gets or sets trailpoint's position. Either local or world coordinates, depending on if trail:uselocalpoints is set.
tpVelarray (l3dtrail,[floatarray 3t])
  returns: ([floatarray 3t])
  sets or returns velocity of active trailpoints from floatarray
typelocal (l3dtrail)
  returns: ()
  local transforms are used on the points. You should do this after a new trail, or after resetting. It does not allow spawnstep.
typeworld (l3dtrail)
  returns: ()
  local transforms are used on the points. You should do this after a new trail, or after resetting. (default)
typeworldref (l3dtrail)
  returns: ()
  points take their world coordinates from linked references. You should do this after a new trail, or after resetting. It does not allow spawnstep.
usevelocity (l3dtrail,[boolean])
  returns: ([boolean])
  sets or returns if velocity vector should be added
velocity (l3dtrail,[float x,y,z])
  returns: ([float x,y,z])
  sets or returns velocity vector in local space, units per second.

## Inherited Methods:

### From l3dnode

cambox, camsphere, camvolumedelete, color, delete, get, isanimateable, lightmap, lightmaptexmatrix, linkbone, linkinterface, localmatrix, localpos, localrotaxis, localrotdeg, localrotrad, name, novistest, parent, renderscale, rotationlock, setlayer, unlink, unlinkbone, updateall, uselocal, usemanualworld, visflag, worldmatrix, worldpos, worldrotaxis, worldrotdeg, worldrotrad

### From l3dlist

reinit