setAwake method

void setAwake (bool flag)

Set the sleep state of the body. A sleeping body has very low CPU cost.

@param flag set to true to put body to sleep, false to wake it. @param flag

Implementation

void setAwake(bool flag) {
  if (flag) {
    if ((_flags & AWAKE_FLAG) == 0) {
      _flags |= AWAKE_FLAG;
      _sleepTime = 0.0;
    }
  } else {
    _flags &= ~AWAKE_FLAG;
    _sleepTime = 0.0;
    _linearVelocity.setZero();
    _angularVelocity = 0.0;
    _force.setZero();
    _torque = 0.0;
  }
}