# Class: dworld

Luxinia uses only one world (ode can simulate multiple worlds) for the sake of simplicity. The dworld class controls the parameters of the ode object. But it also has some special functions like a surfacemanagement system. You can specify 256 different types of surface parametersets that directly set how contacts will react at each other. Each dgeom has a surfaceid and the combination of the two surfaceids will tell the automatic contactgenerator what set of surfaceparameters should be used.

## Hierarchy

    o-+ ode
      o-+ dworld

## Methods:

### Method overview:

- activebodies
- autodisable
- autodisableang
- autodisablesteps
- autodisabletime
- autodisablevel
- cfm
- collidetest
- collisioncount
- collisionget
- contactmaxcorrectingvel
- contactsurfacelayer
- count
- deleteall
- dinfinity
- erp
- get
- getactivebody
- gravity
- iterations
- makecontacts
- maxcollisions
- quickstep
- step
- surfacebitapprox1
- surfacebitapprox2
- surfacebitbounce
- surfacebitfdir
- surfacebitmotion1
- surfacebitmotion2
- surfacebitmu2
- surfacebitslip1
- surfacebitslip2
- surfacebitsoftcfm
- surfacebitsofterp
- surfacebounce
- surfacebouncevel
- surfacecombination
- surfacefdirid
- surfacefdirmixmode
- surfacemotion1
- surfacemotion2
- surfacemu
- surfacemu2
- surfaceslip1
- surfaceslip2
- surfacesoftcfm
- surfacesofterp

activebodies ()
  returns: (int)
  Threadsafe
  Returns the number of currently active bodies.
autodisable ([boolean on])
  returns: ([boolean])
  Threadsafe
  if switched off, bodies won't be disabled. Disabled bodies are no longer consuming CPU power.
autodisableang ([float])
  returns: ([float])
  Threadsafe
  angular velocity at which the body is disabled.
autodisablesteps ([int])
  returns: ([int])
  Threadsafe
  trace depth of activation if an enabled body hits a group of disabled bodies.
autodisabletime ([float])
  returns: ([float])
  Threadsafe
  minimum time until a body can be disabled after exceeding one of the thresholds.
autodisablevel ([float])
  returns: ([float])
  Threadsafe
  velocity at which the body is disabled.
cfm ([double cfm])
  returns: (double erp)
  Threadsafe
  set/get Constraint force mixing parameter (should be around 10e-9 to 1, default=10e-5)
collidetest (dspace space)
  returns: ()
  Threadsafe
  runs collisiondetection on space (and spaces in that space), resets collisionbuffer
collisioncount ()
  returns: ([int])
  Threadsafe
  gets number of calculated collisions
collisionget (int index)
  returns: ([dgeom a,dgeom b])
  Threadsafe
  gets two geoms that may are colliding
contactmaxcorrectingvel ([float])
  returns: ([float])
  Threadsafe
  Set and get the maximum correcting velocity that contacts are allowed to generate. The default value is infinity (i.e. no limit). Reducing this value can help prevent "popping" of deeply embedded objects.
contactsurfacelayer ([float depth])
  returns: ([float])
  Threadsafe
  Set and get the depth of the surface layer around all geometry objects. Contacts are allowed to sink into the surface layer up to the given depth before coming to rest. The default value is zero. Increasing this to some small value (e.g. 0.001) can help prevent jittering problems due to contacts being repeatedly made and broken.
count ()
  returns: (int)
  Threadsafe
  returns sum of spaces,geoms,bodies,joints,jointgroups currently in memory
deleteall ()
  returns: ()
  Threadsafe
  delete all collision stuff
dinfinity ()
  returns: (float)
  Threadsafe
  ODE Infinity value, used by some joints.
erp ([double erp])
  returns: (double erp)
  Threadsafe
  set/get Error Reduction Parameter (should be 0< erp < 1, default=0.2)
get (int index)
  returns: ([dgeom/djoint/djointgroup])
  Threadsafe
  each geom,joint and jointgroup (and all child classes) are stored in a global list that can be traversed.
getactivebody (int index)
  returns: ([dbody])
  Threadsafe
  Returns active (enabled) body of given index. If the index is larger than the active body count, nil is returned.
gravity ([double x,y,z])
  returns: (double x,y,z)
  Threadsafe
  set/get gravity
iterations ([int])
  returns: ([int])
  Threadsafe
  sets/gets number of iterations for quickstep
makecontacts ()
  returns: ()
  Threadsafe
  run this after collidetest if you want to autogenerate the contact joints. This will automaticly reset the default contactgroup.
maxcollisions (int size)
  returns: ([int])
  Threadsafe
  sets/gets maximum number of traceable collisions. Per default this is 4000.
quickstep (float stepsize)
  returns: ()
  Threadsafe
  make a quickstep in simulation
step (float stepsize)
  returns: ()
  Threadsafe
  make a step in simulation. We disadvise to use this function unless you are sure about its consequences. Simulations tend to produce strange error messages plus it is slower than quickstep.
surfacebitapprox1 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  Use the friction pyramid approximation for friction direction 1. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
surfacebitapprox2 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  Use the friction pyramid approximation for friction direction 2. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
surfacebitbounce (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  If set, the contact surface is bouncy, in other words the bodies will bounce off each other. The exact amount of bouncyness is controlled by the bounce parameter.
surfacebitfdir (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  Compute the fdir vector using the given normals of the geoms.
surfacebitmotion1 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  If set, the contact surface is assumed to be moving independently of the motion of the bodies. This is kind of like a conveyor belt running over the surface. When this flag is set, motion1 defines the surface velocity in friction direction 1.
surfacebitmotion2 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  The same thing as above, but for friction direction 2.
surfacebitmu2 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  If not set, use mu for both friction directions. If set, use mu for friction direction 1, use mu2 for friction direction 2.
surfacebitslip1 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  Force-dependent-slip (FDS) in friction direction 1.
surfacebitslip2 (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  Force-dependent-slip (FDS) in friction direction 2.
surfacebitsoftcfm (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  If set, the constraint force mixing parameter of the contact normal can be set with the soft_cfm parameter. This is useful to make surfaces soft.
surfacebitsofterp (int surfaceid,[boolean])
  returns: ([boolean])
  Threadsafe
  If set, the error reduction parameter of the contact normal can be set with the soft_erp parameter. This is useful to make surfaces soft.
surfacebounce (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacebouncevel (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacecombination (int s1,int s2,[int matid])
  returns: ([int])
  Threadsafe
  sets/gets the result for the surfacecombination s1 and s2 (then the surface with surfaceid is selected for the contact parameters. The parameters s1 and s2 are symmetric, so the result for s2 and s1 is the same as for s1 and s2.
surfacefdirid (int surfaceid,[int])
  returns: ([int])
  Threadsafe
  specify the surfaceid of the geom that's fdir normal should be used. If both have the same surface id, the first geom found is used and the outcoming is undefined. The fdirid is only used if the fdirmixmode is set to 4 or 11.
surfacefdirmixmode (int surfaceid,[int mode])
  returns: ([int])
  Threadsafe
  The fdirmixmode specifies how the fdir vectors of different geoms should be handled. The mode values are:
  - use higher surfaceid = 0
  - use lower surfaceid = 1
  - use higher fdirpriority of geom = 2
  - use lower fdirpriority of geom = 3
  - use specified ID of surface = 4
  - mix the fdirs by average = 5
  - mix the fdirs using the priorities (prio1+prio2)/prio1*normal1 + (prio1+prio2)/prio2*normal2 = normal = 6
  - use higher surfaceid as world coordinates = 7
  - use lower surfaceid as world coordinates = 8
  - use higher priority as world coordinates = 9
  - use lower priority as world coordinates = 10
  - use specified ID of surface = 11
  - use average fdirs as world coordinates = 12
  - mix the fdirs as world coordinates based on priorities = 13
surfacemotion1 (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacemotion2 (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacemu (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacemu2 (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfaceslip1 (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfaceslip2 (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacesoftcfm (int surfaceid,[float])
  returns: ([float])
  Threadsafe
surfacesofterp (int surfaceid,[float])
  returns: ([float])
  Threadsafe

## Inherited Methods: