Exemplo n.º 1
0
        static NativeList <VelocityObstacle> ComputeNeighbours(RVOSettingsComponent agent, DynamicTreeElementComponent agentTree, float2 pos, ComponentDataFromEntity <VelocityObstacleComponent> velocityObstacleLookup)
        {
            var neighbours = new NativeList <VelocityObstacle>(agent.MaxNeighbours, Allocator.Temp);
            var ext        = agent.NeighbourDist / 2;
            var aabb       = new AABB {
                LowerBound = pos - ext, UpperBound = pos + ext
            };

            agentTree.Query(new VelocityObstacleCollector(pos, agent.NeighbourDist, agent.MaxNeighbours, neighbours, velocityObstacleLookup), aabb);
            return(neighbours);
        }
        public static NativeList <Entity> ComputeNeighbours(this DynamicTreeElementComponent treeElement, float neighbourDist,
                                                            float2 pos, ComponentDataFromEntity <VelocityObstacleComponent> velocityObstacleLookup)
        {
            var neighbours = new NativeList <Entity>(Allocator.Temp);
            var ext        = neighbourDist / 2;
            var aabb       = new AABB {
                LowerBound = pos - ext, UpperBound = pos + ext
            };

            treeElement.Query(new DistanceCollector(pos, neighbourDist, neighbours, velocityObstacleLookup), aabb);
            return(neighbours);
        }