# Class: l3dnode

l3dnodes of different classes represent any visual item you want to draw, models, particles etc. Each l3dnode can have a subtree of l3dnodes, however visibilty is only tested for the root l3dnode, so if the root is not visible, childs won't be either. For a l3dnode to become active it must be linked with a actornode or scenenode, from which it will get its world position information.
for more info on the order nodes are rendered see l3dset.
Retrieving world positions and rotations can return wrong results. Because world updates are only done when the node was visible. So they lag one frame behind. Alternatively you can use updateall to enforce uptodate world data.

## Hierarchy

    o-+ l3dlist
      o-+ l3dnode
        o-- l3dcamera
        o-- l3dlevelmodel
        o-- l3dlight
        o-- l3dmodel
        o-- l3dpemitter
        o-- l3dpgroup
        o-- l3dprimitive
        o-- l3dprojector
        o-- l3dshadowmodel
        o-- l3dtbterrain
        o-- l3dtext
        o-- l3dtrail

## Methods:

### Method overview:

- 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
- updateall
- uselocal
- uselookat
- usemanualworld
- visflag
- worldmatrix
- worldpos
- worldrotaxis
- worldrotdeg
- worldrotquat
- worldrotrad

cambox (l3dnode node,boolean inside,float outer min x,y,z,float outer max x,y,z,[float inner min x,y,z, float inner max x,y,z])
  returns: ()
  sets visibility box, if camera is inside (inside set to true) / outside (inside set to false) the box it will be drawn. If you pass the second box,which must be smaller than the first, we will perform a ranged check. This means the node will be marked as inside if camera is within outer box, and outside of innerbox.
camsphere (l3dnode node,boolean inside,float outer range, [float inner range])
  returns: ()
  sets visibilty sphere, if camera is inside (inside set to true) / outside (inside set to false) the sphere it will be drawn. If you pass the inner range we will perform a ranged check. This means the node will be marked as inside if camera is within outer sphere, and outside of inner sphere.
camvolumedelete (l3dnode node)
  returns: ()
  removes the extra visibility test based on camera position
color (l3dnode node,[meshid],[float r,g,b,a])
  returns: ([float r,g,b,a])
  returns or sets node's color. Only used when rfNovertexcolor is set. Optionally can pass meshid for l3dmodels
delete (l3dnode node)
  returns: ()
  deletes l3dnode, by default children are also deleted
isanimateable (l3dnode)
  returns: (boolean)
  checks if the l3dnode is a l3dmodel and if yes, if it can be animated. Won't throw an error if a valid l3d is passed.
lastframe (l3dnode node)
  returns: ([int])
  returns the last frame the node was rendered in.
lightmap (l3dnode node,[texture])
  returns: ([texture])
  sets or returns node's lightmap, if not a texture is passed as argument, it will be disabled.
lightmaptexmatrix (l3dnode node,[matrix4x4])
  returns: ([matrix4x4])
  sets or returns node's lightmap texmatrix, if not a matrix4x4 is passed as argument, it will be disabled.
linkinterface (l3dnode node,[scenenode]/[actornode])
  returns: ([scenenode]/[actornode])
  links l3dnode to interfaces of scenenode or actornode (or returns current)
localmatrix (l3dnode node,[matrix4x4])
  returns: ([matrix4x4])
  returns or sets local matrix. As visibility culling is based on the scene/actornode using too much localposition offsets can create problems. You should rather create new actor/scenenodes in that case.
localpos (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets local position. As visibility culling is based on the scene/actornode using too much localposition offsets can create problems. You should rather create new actor/scenenodes in that case.
localrotaxis (l3dnode node,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])
  returns: ([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])
  returns or sets local rotation axis, make sure they make a orthogonal basis.
localrotdeg (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets local rotation in degrees
localrotquat (l3dnode node,[float x,y,z,w])
  returns: ([float x,y,z,w])
  returns or sets local rotation as quaternion
localrotrad (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets local rotation in radians
name (l3dnode node)
  returns: (string name)
  returns name
novistest (l3dnode,[boolean])
  returns: ([boolean])
  gets or sets novistest state. If set to true, node will always be drawn, as well as all its children.
parent (l3dnode node,[l3dnode parent])
  returns: ([l3dnode parent])
  links node to a parent. ==parent prevents gc of self
parentbone (l3dnode node,string bonename)
  returns: ()
  tries to link node to parent's bonesystem
renderscale (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets render scale factor. (1,1,1) will disable renderscale, which is cheaper to render. For l3dpemitters it applies scaling to subsystem offsets. For l3dprimitives this matches size on start, however setting renderscale overrides size, and size changes will only affect bbox.
rotationlock (l3dnode node,int axis,[boolean state])
  returns: (boolean)
  returns or sets rotation lock. axis 0=X 1=Y 2=Z 3=All. Rotation lock is applied before local transforms.
setlayer (l3dnode,l3dlayerid,[meshid])
  returns: ()
  sets the nodes layer/set. l3dmodels can pass meshid. An l3dset change always affects all
unlink (l3dnode node)
  returns: ()
  fully unlinks l3dnode, wont be drawn until linked again
unparentbone (l3dnode node)
  returns: ()
  unlinks l3dnode from bone
updateall ()
  returns: ()
  updates world positions of all l3d nodes, visible or not. Useful if you need that data after you created and linked l3ds.
uselocal (l3dnode node,[boolean])
  returns: ([boolean])
  enables local matrices, automatically on when you link to another l3dnode. You must not call it before the l3dnode was linked.
uselookat (l3dnode,[boolean])
  returns: ([boolean])
  gets or sets if node should face camera. Local updates are done post align.
usemanualworld (l3dnode node,[boolean])
  returns: ([boolean])
  enables manual world matrices. Bonelinking, inheritlocks and local matrices will be disabled. You must not call it before the l3dnode was linked.
visflag (l3dnode,int id 0-31,[boolean])
  returns: ([boolean])
  gets or sets visiblity status for each id. If a camera's id is set to true, the l3dnode will be visible to it. By default all are visible to id 0, which is the default camera.
worldmatrix (l3dnode node,[matrix4x4/ actornode / scenenode])
  returns: ([matrix4x4])
  returns or sets world matrix. Setting only allowed if 'usemanualworld' is true.
worldpos (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets last world position. Setting only allowed if 'usemanualworld' is true.
worldrotaxis (l3dnode node,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])
  returns: ([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])
  returns or sets last world rotation axis, make sure they make a orthogonal basis. Setting only allowed if 'usemanualworld' is true.
worldrotdeg (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets last world rotation in degrees. Setting only allowed if 'usemanualworld' is true.
worldrotquat (l3dnode node,[float x,y,z,w])
  returns: ([float x,y,z,w])
  returns or sets local rotation as quaternion. Setting only allowed if 'usemanualworld' is true.
worldrotrad (l3dnode node,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets last world rotation in radians. Setting only allowed if 'usemanualworld' is true.

## Inherited Methods:

### From l3dlist