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(); } }
void BodySW::wakeup_neighbours() { for(Map<ConstraintSW*,int>::Element *E=constraint_map.front();E;E=E->next()) { const ConstraintSW *c=E->key(); BodySW **n = c->get_body_ptr(); int bc=c->get_body_count(); for(int i=0;i<bc;i++) { if (i==E->get()) continue; BodySW *b = n[i]; if (b->mode!=PhysicsServer::BODY_MODE_RIGID) continue; if (!b->is_active()) b->set_active(true); } } }