# Class: l3dmodel

l3dnode of a model instance. Every l3dmodel has unique materials, bone and morph data, if specified. You can apply boneanimation with the sequence commands, control bones with bonecontrol or run morphing with morphcontrol. On creation the l3dmodel will copy all material and renderflags (if material provides a shader) data from the source model.

## Hierarchy

    o-+ l3dlist
      o-+ l3dnode
        o-+ l3dmodel

## Interfaces:

- matobject
- renderflag
- rendersurface

## Methods:

### Method overview:

- bonematrix
- bonepos
- bonereset
- bonerotaxis
- bonerotdeg
- bonerotrad
- bonesinworldspace
- getindexarray
- getl3dbatchbuffer
- getmodel
- getvertexarray
- matsurface
- morphreset
- new
- newinstance
- nonbatchable
- projectorflag
- seqAnimMax
- seqAnimlength
- seqAnimsource
- seqAnimstart
- seqBlendfactor
- seqBlendmanual
- seqDuration
- seqLoop
- seqMax
- seqOffset
- seqSpeed
- seqState
- seqTime

new (string name,|l3dlayerid|,model,[boolean boneanim],[boolean meshanim])
  returns: (l3dmodel)
  creates l3dmodel. If you want to be able to apply animations on it set boneanim to true. If you want it to have unique vertices or allow morphing set meshanim to true. (both default to false)
bonematrix (l3dmodel,boneid/string bonename)
  returns: (matrix4x4)
  gets bone matrix
bonepos (l3dmodel,boneid/string bonename)
  returns: (float x,y,z)
  gets bone position
bonereset (l3dmodel)
  returns: ()
  sets bones to reference positions
bonerotaxis (l3dmodel,boneid/string bonename)
  returns: (float Xx,Xy,Xz,Yx,Yy,Yz,Zx,Zy,Zz)
  gets bone rotation axis
bonerotdeg (l3dmodel,boneid/string bonename)
  returns: (float x,y,z)
  gets bone rotation degrees
bonerotrad (l3dmodel,boneid/string bonename)
  returns: (float x,y,z)
  gets bone rotation radians
bonesinworldspace (l3dmodel,[boolean])
  returns: ([boolean])
  returns or sets if bones should be calculated in world space. If set in worldspace you cannot instance this l3dmodel, and you will get problems when others were already instanced.
getindexarray (l3dmodel,meshid)
  returns: (vertexarray)
  returns vertexarray of a batched l3dmodel's mesh.
getl3dbatchbuffer (l3dmodel)
  returns: ([l3dbatchbuffer])
  returns batchbuffer of the model, if it was batched.
getmodel (l3dnode)
  returns: (model)
  returns model of this l3dnode
getvertexarray (l3dmodel,meshid)
  returns: (vertexarray)
  returns vertexarray of a batched or morphable l3dmodel's mesh.
matsurface (l3dnode,meshid,[matsurface])
  returns: ([material/texture])
  sets or returns material of specific mesh
morphreset (l3dmodel)
  returns: ()
  sets morphdata to reference positions
newinstance (string name,|l3dlayerid|,l3dmodel)
  returns: (l3dmodel)
  creates instance of another l3dmodel, they will share bone and morph data. Only works if bone data is not set to worldspace.
nonbatchable (l3dmodel,[boolean])
  returns: ([boolean])
  returns or sets state. If a batchbuffer affects this model it will not be included.
projectorflag (l3dnode,int id,[boolean])
  returns: ([boolean])
  returns or sets to which projectors the model reacts to. id is 0-31.
seqAnimMax ()
  returns: ([int])
  returns how many anims per sequence can be set
seqAnimlength (l3dmodel,int sequence,int anim,[int])
  returns: ([int])
  sets or returns sequence:anim length
seqAnimsource (l3dmodel,int sequence,int anim,[animation])
  returns: ([animation])
  sets or returns sequence:anim animation
seqAnimstart (l3dmodel,int sequence,int anim,[int])
  returns: ([int])
  sets or returns sequence:anim start time
seqBlendfactor (l3dmodel,int sequence,[float])
  returns: ([float])
  sets or returns blendfactor of sequence
seqBlendmanual (l3dmodel,int sequence,[boolean])
  returns: ([boolean])
  sets or returns if sequence is blended manually
seqDuration (l3dmodel,int sequence)
  returns: (int)
  returns duration of sequence
seqLoop (l3dmodel,int sequence,[boolean])
  returns: ([boolean])
  sets or returns if sequence loops, default is true
seqMax ()
  returns: ([int])
  returns how many sequences can be set.
seqOffset (l3dmodel,int sequence,[int])
  returns: ([int])
  sets or returns current offset between anims of sequence, negative means overlapping. Dont call before anims were set. It will also set the proper duration for the sequence.
seqSpeed (l3dmodel,int sequence,[float])
  returns: ([float])
  sets or returns speed of sequence, default is 1
seqState (l3dmodel,int sequence,[int state])
  returns: ([int])
  sets or returns state of sequence. 0 inactive, 1 run, 2 pause, 3 singleframe
seqTime (l3dmodel,int sequence,[int])
  returns: ([int])
  sets or returns current time of sequence

## 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