MCPcopy Create free account
hub / github.com/ByteArena/box2d / SetActive

Method SetActive

DynamicsB2Body.go:876–913  ·  view source on GitHub ↗
(flag bool)

Source from the content-addressed store, hash-verified

874}
875
876func (body *B2Body) SetActive(flag bool) {
877
878 B2Assert(body.M_world.IsLocked() == false)
879
880 if flag == body.IsActive() {
881 return
882 }
883
884 if flag {
885 body.M_flags |= B2Body_Flags.E_activeFlag
886
887 // Create all proxies.
888 broadPhase := &body.M_world.M_contactManager.M_broadPhase
889 for f := body.M_fixtureList; f != nil; f = f.M_next {
890 f.CreateProxies(broadPhase, body.M_xf)
891 }
892
893 // Contacts are created the next time step.
894 } else {
895 body.M_flags &= ^B2Body_Flags.E_activeFlag
896
897 // Destroy all proxies.
898 broadPhase := &body.M_world.M_contactManager.M_broadPhase
899 for f := body.M_fixtureList; f != nil; f = f.M_next {
900 f.DestroyProxies(broadPhase)
901 }
902
903 // Destroy the attached contacts.
904 ce := body.M_contactList
905 for ce != nil {
906 ce0 := ce
907 ce = ce.Next
908 body.M_world.M_contactManager.Destroy(ce0.Contact)
909 }
910
911 body.M_contactList = nil
912 }
913}
914
915func (body *B2Body) SetFixedRotation(flag bool) {
916 status := (body.M_flags & B2Body_Flags.E_fixedRotationFlag) == B2Body_Flags.E_fixedRotationFlag

Callers

nothing calls this directly

Calls 6

IsActiveMethod · 0.95
B2AssertFunction · 0.85
IsLockedMethod · 0.80
CreateProxiesMethod · 0.80
DestroyProxiesMethod · 0.80
DestroyMethod · 0.65

Tested by

no test coverage detected