void StepSW::_check_suspend(BodySW *p_island,float p_delta) { bool can_sleep=true; BodySW *b = p_island; while(b) { if (b->get_mode()==PhysicsServer::BODY_MODE_STATIC) continue; //ignore for static if (!b->sleep_test(p_delta)) can_sleep=false; b=b->get_island_next(); } //put all to sleep or wake up everyoen b = p_island; while(b) { if (b->get_mode()==PhysicsServer::BODY_MODE_STATIC) continue; //ignore for static bool active = b->is_active(); if (active==can_sleep) b->set_active(!can_sleep); b=b->get_island_next(); } }