public void CalculateIntersectAgents(AABB rect, DynamicTreeQueryCallback callback, Stack <int> queryStack) { queryStack.Clear(); if (_dynamicTree != null) { _dynamicTree.Query(callback, ref rect, queryStack, false); } }
public void CalculateAgentNeighbours(PathFindingAgentBehaviour agent, DynamicTreeQueryCallback callback, FP radius) { if (agent.proxyId < 0) { return; } AABB ab = new AABB(); ab.lowerBound = new TSVector2(agent.position.x - radius, agent.position.z - radius); ab.upperBound = new TSVector2(agent.position.x + radius, agent.position.z + radius); agent.pathManager._queryStack.Clear(); if (_dynamicTree != null) { _dynamicTree.Query(callback, ref ab, agent.pathManager._queryStack, false); } }
// = new Stack<int>(); /// Query an AABB for overlapping proxies. The callback class /// is called for each proxy that overlaps the supplied AABB. public bool Query(DynamicTreeQueryCallback callback, ref AABB aabb, Stack <int> _tmpStack, bool bTestHasNode) { _tmpStack.Clear(); _tmpStack.Push(_root); while (_tmpStack.Count > 0) { int nodeId = _tmpStack.Pop(); if (nodeId == TreeNode <T> .nullNode) { continue; } TreeNode <T> node = _nodes[nodeId]; if (TestOverlap(ref node.aabb, ref aabb)) { if (node.IsLeaf()) { if (bTestHasNode) { return(true); } bool proceed = callback(nodeId); if (proceed == false) { return(false); } } else { _tmpStack.Push(node.child1); _tmpStack.Push(node.child2); } } } return(false); }
void Start() { _dynamicQueryCallBack = this.DynamicTreeQueryCallback; }
public void CalculateColliders(TSVector pos, FP radius, Stack <int> queryStack, DynamicTreeQueryCallback callback) { if (_dynamicTree == null) { return; } AABB ab = new AABB(); ab.lowerBound = new TSVector2(pos.x - radius, pos.z - radius); ab.upperBound = new TSVector2(pos.x + radius, pos.z + radius); _dynamicTree.Query(callback, ref ab, queryStack, false); }