forked from ByteArena/box2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDynamicsB2ContactChainAndPolygon.go
33 lines (27 loc) · 1.29 KB
/
DynamicsB2ContactChainAndPolygon.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package box2d
type ChainAndPolygonContact struct {
Contact
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// B2ChainAndPolygonContact.cpp
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
func ChainAndPolygonContact_Create(fixtureA *Fixture, indexA int, fixtureB *Fixture, indexB int) ContactInterface {
assert(fixtureA.GetType() == ShapeType.Chain)
assert(fixtureB.GetType() == ShapeType.Polygon)
res := &ChainAndPolygonContact{
Contact: MakeContact(fixtureA, indexA, fixtureB, indexB),
}
return res
}
func ChainAndPolygonContact_Destroy(contact ContactInterface) { // should be a pointer
}
func (contact *ChainAndPolygonContact) Evaluate(manifold *Manifold, xfA Transform, xfB Transform) {
chain := contact.GetFixtureA().GetShape().(*ChainShape)
edge := MakeEdgeShape()
chain.GetChildEdge(&edge, contact.M_indexA)
CollideEdgeAndPolygon(manifold, &edge, xfA, contact.GetFixtureB().GetShape().(*PolygonShape), xfB)
}