# Class: scenenode

The SceneTree is a hierarchical SceenGraph organised as tree, containing scenenodes. The purpose of scenenodes is to provide positional information in space without information about visual appearance or collision behavior. The matrices of the actors can be linked against l3dnodes in order to display objects on the screen.
Each actor has a name and can be found by using the name. Scenenodes with the same name are grouped in a ring list that can be traversed.
The SceneTree is optimized for static data, for dynamic nodes better use actornodes, however the scenenodes can be changed in position and rotation just fine as well.
Retrieving world data can return wrong results, you need to wait one frame until they are uptodate or enforce a full tree updateall.

## Hierarchy

    o-+ spatialnode
      o-+ scenenode

## Interfaces:

- hashid

## Methods:

### Method overview:

- delete
- deleteall
- get
- getnextname
- getroot
- link
- localmatrix
- localpos
- localrotaxis
- localrotdeg
- localrotrad
- new
- terrain
- transform
- updateall
- vistestbbox
- worldmatrix
- worldpos
- worldrotaxis
- worldrotdeg
- worldrotrad

new (string name,[boolean drawable],[float x,y,z])
  returns: ([scenenode s3d])
  creates a new scenenode with given position as local pos
delete (scenenode,[boolean withchildren])
  returns: ()
  removes the Node from the SceneTree and deletes it. withchildren defaults to false
deleteall ()
  returns: ()
  clear the scenetree system
get (string name)
  returns: ([scenenode s3d])
  returns a node
getnextname (scenenode s3d)
  returns: (scenenode s3d)
  returns a node within same namegroup of given node
getroot ()
  returns: (scenenode s3d)
  returns the root node. The root node cant be deleted nor modified
link (scenenode s3d,boolean withchildren,scenenode parent)
  returns: ()
  links s3d 'withchildren' to parent/root
localmatrix (scenenode s3d,[matrix16])
  returns: ([matrix16])
  updates node's local matrix or returns it
localpos (scenenode s3d,[float x,y,z])
  returns: (float x,y,z)
  updates node's local position or returns it
localrotaxis (scenenode s3d,[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 (scenenode s3d,[float x,y,z])
  returns: (float x,y,z)
  updates node's local rotation or returns it in degrees
localrotrad (scenenode s3d,[float x,y,z])
  returns: (float x,y,z)
  updates node's local rotation or returns it in radians
terrain (scenenode,[terrain]/[l3dterrain])
  returns: (terrain)
  returns or sets scenenode as terrain. Children will be put on terrain with local matrix Z as offset in height.
transform (scenenode self,float x,y,z)
  returns: (float x,y,z)
  transforms x,y,z with final matrix of the node into world coordinates
updateall ()
  returns: ()
  done automatically before rendering is done, but if you need uptodate world data, right after setting your scenenodes, call this function.
vistestbbox (scenenode self, [float minX,minY,minZ,maxX,maxY,maxZ])
  returns: ([float minX,minY,minZ,maxX,maxY,maxZ])
  sets/gets visibility testing boundingbox when scenenode is drawable
worldmatrix (scenenode s3d)
  returns: ([matrix16])
  returns node's world matrix
worldpos (scenenode s3d)
  returns: (float x,y,z)
  returns world position
worldrotaxis (scenenode s3d,[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.
worldrotdeg (scenenode s3d)
  returns: (float x,y,z)
  returns world rotation (degrees)
worldrotrad (scenenode s3d)
  returns: (float x,y,z)
  returns world rotation (radians)

## Inherited Methods: