Exemplo n.º 1
0
 public void CalculateIntersectAgents(AABB rect, DynamicTreeQueryCallback callback, Stack <int> queryStack)
 {
     queryStack.Clear();
     if (_dynamicTree != null)
     {
         _dynamicTree.Query(callback, ref rect, queryStack, false);
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        //  = 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);
        }
Exemplo n.º 4
0
 void Start()
 {
     _dynamicQueryCallBack = this.DynamicTreeQueryCallback;
 }
Exemplo n.º 5
0
        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);
        }