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

Method Destroy

DynamicsB2ContactManager.go:29–81  ·  view source on GitHub ↗
(c B2ContactInterface)

Source from the content-addressed store, hash-verified

27}
28
29func (mgr *B2ContactManager) Destroy(c B2ContactInterface) {
30 fixtureA := c.GetFixtureA()
31 fixtureB := c.GetFixtureB()
32 bodyA := fixtureA.GetBody()
33 bodyB := fixtureB.GetBody()
34
35 if mgr.M_contactListener != nil && c.IsTouching() {
36 mgr.M_contactListener.EndContact(c)
37 }
38
39 // Remove from the world.
40 if c.GetPrev() != nil {
41 c.GetPrev().SetNext(c.GetNext())
42 }
43
44 if c.GetNext() != nil {
45 c.GetNext().SetPrev(c.GetPrev())
46 }
47
48 if c == mgr.M_contactList {
49 mgr.M_contactList = c.GetNext()
50 }
51
52 // Remove from body 1
53 if c.GetNodeA().Prev != nil {
54 c.GetNodeA().Prev.Next = c.GetNodeA().Next
55 }
56
57 if c.GetNodeA().Next != nil {
58 c.GetNodeA().Next.Prev = c.GetNodeA().Prev
59 }
60
61 if c.GetNodeA() == bodyA.M_contactList {
62 bodyA.M_contactList = c.GetNodeA().Next
63 }
64
65 // Remove from body 2
66 if c.GetNodeB().Prev != nil {
67 c.GetNodeB().Prev.Next = c.GetNodeB().Next
68 }
69
70 if c.GetNodeB().Next != nil {
71 c.GetNodeB().Next.Prev = c.GetNodeB().Prev
72 }
73
74 if c.GetNodeB() == bodyB.M_contactList {
75 bodyB.M_contactList = c.GetNodeB().Next
76 }
77
78 // Call the factory.
79 B2ContactDestroy(c)
80 mgr.M_contactCount--
81}
82
83// This is the top level collision call for the time step. Here
84// all the narrow phase collision is processed for the world

Callers 1

CollideMethod · 0.95

Calls 12

B2ContactDestroyFunction · 0.85
GetBodyMethod · 0.80
EndContactMethod · 0.80
GetFixtureAMethod · 0.65
GetFixtureBMethod · 0.65
IsTouchingMethod · 0.65
GetPrevMethod · 0.65
SetNextMethod · 0.65
GetNextMethod · 0.65
SetPrevMethod · 0.65
GetNodeAMethod · 0.65
GetNodeBMethod · 0.65

Tested by

no test coverage detected