MCPcopy Create free account
hub / github.com/defold/defold / SetActive

Method SetActive

external/box2d_v2/Box2D/Dynamics/b2Body.cpp:489–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489void 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
534void b2Body::Dump()
535{

Callers 3

SetEnabled2DFunction · 0.80
ReplaceShape2DFunction · 0.80
Body_SetActiveFunction · 0.80

Calls 4

IsLockedMethod · 0.80
CreateProxiesMethod · 0.80
DestroyProxiesMethod · 0.80
DestroyMethod · 0.45

Tested by

no test coverage detected