| 487 | } |
| 488 | |
| 489 | void b2Body::SetActive(bool flag) |
| 490 | { |
| 491 | b2Assert(m_world->IsLocked() == false); |
| 492 | |
| 493 | if (flag == IsActive()) |
| 494 | { |
| 495 | return; |
| 496 | } |
| 497 | |
| 498 | if (flag) |
| 499 | { |
| 500 | m_flags |= e_activeFlag; |
| 501 | |
| 502 | // Create all proxies. |
| 503 | b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; |
| 504 | for (b2Fixture* f = m_fixtureList; f; f = f->m_next) |
| 505 | { |
| 506 | f->CreateProxies(broadPhase, m_xf); |
| 507 | } |
| 508 | |
| 509 | // Contacts are created the next time step. |
| 510 | } |
| 511 | else |
| 512 | { |
| 513 | m_flags &= ~e_activeFlag; |
| 514 | |
| 515 | // Destroy all proxies. |
| 516 | b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; |
| 517 | for (b2Fixture* f = m_fixtureList; f; f = f->m_next) |
| 518 | { |
| 519 | f->DestroyProxies(broadPhase); |
| 520 | } |
| 521 | |
| 522 | // Destroy the attached contacts. |
| 523 | b2ContactEdge* ce = m_contactList; |
| 524 | while (ce) |
| 525 | { |
| 526 | b2ContactEdge* ce0 = ce; |
| 527 | ce = ce->next; |
| 528 | m_world->m_contactManager.Destroy(ce0->contact); |
| 529 | } |
| 530 | m_contactList = NULL; |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | void b2Body::Dump() |
| 535 | { |
no test coverage detected