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

Method CreateProxy

CollisionB2DynamicTree.go:266–280  ·  view source on GitHub ↗

Create a proxy in the tree as a leaf node. We return the index of the node instead of a pointer so that we can grow the node pool.

(aabb B2AABB, userData interface{})

Source from the content-addressed store, hash-verified

264// of the node instead of a pointer so that we can grow
265// the node pool.
266func (tree *B2DynamicTree) CreateProxy(aabb B2AABB, userData interface{}) int {
267
268 proxyId := tree.AllocateNode()
269
270 // Fatten the aabb.
271 r := MakeB2Vec2(B2_aabbExtension, B2_aabbExtension)
272 tree.M_nodes[proxyId].Aabb.LowerBound = B2Vec2Sub(aabb.LowerBound, r)
273 tree.M_nodes[proxyId].Aabb.UpperBound = B2Vec2Add(aabb.UpperBound, r)
274 tree.M_nodes[proxyId].UserData = userData
275 tree.M_nodes[proxyId].Height = 0
276
277 tree.InsertLeaf(proxyId)
278
279 return proxyId
280}
281
282func (tree *B2DynamicTree) DestroyProxy(proxyId int) {
283 B2Assert(0 <= proxyId && proxyId < tree.M_nodeCapacity)

Callers

nothing calls this directly

Calls 5

AllocateNodeMethod · 0.95
InsertLeafMethod · 0.95
MakeB2Vec2Function · 0.85
B2Vec2SubFunction · 0.85
B2Vec2AddFunction · 0.85

Tested by

no test coverage detected