| 454 | } |
| 455 | |
| 456 | void b2Body::SetActive(bool flag) |
| 457 | { |
| 458 | b2Assert(m_world->IsLocked() == false); |
| 459 | |
| 460 | if (flag == IsActive()) |
| 461 | { |
| 462 | return; |
| 463 | } |
| 464 | |
| 465 | if (flag) |
| 466 | { |
| 467 | m_flags |= e_activeFlag; |
| 468 | |
| 469 | // Create all proxies. |
| 470 | b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; |
| 471 | for (b2Fixture* f = m_fixtureList; f; f = f->m_next) |
| 472 | { |
| 473 | f->CreateProxies(broadPhase, m_xf); |
| 474 | } |
| 475 | |
| 476 | // Contacts are created the next time step. |
| 477 | } |
| 478 | else |
| 479 | { |
| 480 | m_flags &= ~e_activeFlag; |
| 481 | |
| 482 | // Destroy all proxies. |
| 483 | b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; |
| 484 | for (b2Fixture* f = m_fixtureList; f; f = f->m_next) |
| 485 | { |
| 486 | f->DestroyProxies(broadPhase); |
| 487 | } |
| 488 | |
| 489 | // Destroy the attached contacts. |
| 490 | b2ContactEdge* ce = m_contactList; |
| 491 | while (ce) |
| 492 | { |
| 493 | b2ContactEdge* ce0 = ce; |
| 494 | ce = ce->next; |
| 495 | m_world->m_contactManager.Destroy(ce0->contact); |
| 496 | } |
| 497 | m_contactList = NULL; |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | void b2Body::SetFixedRotation(bool flag) |
| 502 | { |
no test coverage detected