(b *B2Body)
| 207 | } |
| 208 | |
| 209 | func (world *B2World) DestroyBody(b *B2Body) { |
| 210 | B2Assert(world.M_bodyCount > 0) |
| 211 | B2Assert(world.IsLocked() == false) |
| 212 | |
| 213 | if world.IsLocked() { |
| 214 | return |
| 215 | } |
| 216 | |
| 217 | // Delete the attached joints. |
| 218 | je := b.M_jointList |
| 219 | for je != nil { |
| 220 | je0 := je |
| 221 | je = je.Next |
| 222 | |
| 223 | if world.M_destructionListener != nil { |
| 224 | world.M_destructionListener.SayGoodbyeToJoint(je0.Joint) |
| 225 | } |
| 226 | |
| 227 | world.DestroyJoint(je0.Joint) |
| 228 | |
| 229 | b.M_jointList = je |
| 230 | } |
| 231 | b.M_jointList = nil |
| 232 | |
| 233 | // Delete the attached contacts. |
| 234 | ce := b.M_contactList |
| 235 | for ce != nil { |
| 236 | ce0 := ce |
| 237 | ce = ce.Next |
| 238 | world.M_contactManager.Destroy(ce0.Contact) |
| 239 | } |
| 240 | b.M_contactList = nil |
| 241 | |
| 242 | // Delete the attached fixtures. This destroys broad-phase proxies. |
| 243 | f := b.M_fixtureList |
| 244 | for f != nil { |
| 245 | f0 := f |
| 246 | f = f.M_next |
| 247 | |
| 248 | if world.M_destructionListener != nil { |
| 249 | world.M_destructionListener.SayGoodbyeToFixture(f0) |
| 250 | } |
| 251 | |
| 252 | f0.DestroyProxies(&world.M_contactManager.M_broadPhase) |
| 253 | f0.Destroy() |
| 254 | |
| 255 | b.M_fixtureList = f |
| 256 | b.M_fixtureCount -= 1 |
| 257 | } |
| 258 | |
| 259 | b.M_fixtureList = nil |
| 260 | b.M_fixtureCount = 0 |
| 261 | |
| 262 | // Remove world body list. |
| 263 | if b.M_prev != nil { |
| 264 | b.M_prev.M_next = b.M_next |
| 265 | } |
| 266 |
nothing calls this directly
no test coverage detected