- Main Page
- Modules
- Data Structures
- Files

# Automatic Enabling and Disabling

## Functions
ODE_API void | dWorldSetAutoEnableDepthSF1 (dWorldID, int autoEnableDepth)
| Set the AutoEnableDepth parameter used by the StepFast1 algorithm.
ODE_API int | dWorldGetAutoEnableDepthSF1 (dWorldID)
| Get the AutoEnableDepth parameter used by the StepFast1 algorithm.
ODE_API dReal | dWorldGetAutoDisableLinearThreshold (dWorldID)
| Get auto disable linear threshold for newly created bodies.
ODE_API void | dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold)
| Set auto disable linear threshold for newly created bodies.
ODE_API dReal | dWorldGetAutoDisableAngularThreshold (dWorldID)
| Get auto disable angular threshold for newly created bodies.
ODE_API void | dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold)
| Set auto disable angular threshold for newly created bodies.
ODE_API int | dWorldGetAutoDisableSteps (dWorldID)
| Get auto disable steps for newly created bodies.
ODE_API void | dWorldSetAutoDisableSteps (dWorldID, int steps)
| Set auto disable steps for newly created bodies.
ODE_API dReal | dWorldGetAutoDisableTime (dWorldID)
| Get auto disable time for newly created bodies.
ODE_API void | dWorldSetAutoDisableTime (dWorldID, dReal time)
| Set auto disable time for newly created bodies.
ODE_API int | dWorldGetAutoDisableFlag (dWorldID)
| Get auto disable flag for newly created bodies.
ODE_API void | dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable)
| Set auto disable flag for newly created bodies.

## Detailed Description

Every body can be enabled or disabled. Enabled bodies participate in the simulation, while disabled bodies are turned off and do not get updated during a simulation step. New bodies are always created in the enabled state.

A disabled body that is connected through a joint to an enabled body will be automatically re-enabled at the next simulation step.

Disabled bodies do not consume CPU time, therefore to speed up the simulation bodies should be disabled when they come to rest. This can be done automatically with the auto-disable feature.

If a body has its auto-disable flag turned on, it will automatically disable itself when

- It has been idle for a given number of simulation steps.
- It has also been idle for a given amount of simulation time.

A body is considered to be idle when the magnitudes of both its linear velocity and angular velocity are below given thresholds.

Thus, every body has five auto-disable parameters: an enabled flag, a idle step count, an idle time, and linear/angular velocity thresholds. Newly created bodies get these parameters from world.

## Function Documentation

ODE_API dReal dWorldGetAutoDisableAngularThreshold | ( | dWorldID |  | ) |

| Get auto disable angular threshold for newly created bodies. Returns: the threshold

ODE_API int dWorldGetAutoDisableFlag | ( | dWorldID |  | ) |

| Get auto disable flag for newly created bodies. Returns: 0 or 1

ODE_API dReal dWorldGetAutoDisableLinearThreshold | ( | dWorldID |  | ) |

| Get auto disable linear threshold for newly created bodies. Returns: the threshold

ODE_API int dWorldGetAutoDisableSteps | ( | dWorldID |  | ) |

| Get auto disable steps for newly created bodies. Returns: nr of steps

ODE_API dReal dWorldGetAutoDisableTime | ( | dWorldID |  | ) |

| Get auto disable time for newly created bodies. Returns: nr of seconds

ODE_API void dWorldSetAutoDisableAngularThreshold | ( | dWorldID | ,
|  | dReal | angular_threshold
| ) |

  | Set auto disable angular threshold for newly created bodies. Parameters:
  | linear_threshold | default is 0.01

ODE_API void dWorldSetAutoDisableFlag | ( | dWorldID | ,
|  | int | do_auto_disable
| ) |

  | Set auto disable flag for newly created bodies. Parameters:
  | do_auto_disable | default is false.

ODE_API void dWorldSetAutoDisableLinearThreshold | ( | dWorldID | ,
|  | dReal | linear_threshold
| ) |

  | Set auto disable linear threshold for newly created bodies. Parameters:
  | linear_threshold | default is 0.01

ODE_API void dWorldSetAutoDisableSteps | ( | dWorldID | ,
|  | int | steps
| ) |

  | Set auto disable steps for newly created bodies. Parameters:
  | steps | default is 10

ODE_API void dWorldSetAutoDisableTime | ( | dWorldID | ,
|  | dReal | time
| ) |

  | Set auto disable time for newly created bodies. Parameters:
  | time | default is 0 seconds