I have a world in which I have some EdgeShape objects that I use to outline the border of my terrain, my terrain is quite large and currently uses 2464 EdgeShapes. I have added one DynamicBody (which I set as a box) to the world that I use as my character, I then use this character shape to navigate around my map.
The trouble is that performance is quite bad.
I do not know how the collision code is run and cannot seem to find any resources on the matter. I would specifically like to know a few things;
1 - Are all of the EdgeShape objects checking for collisions with other EdgeShape objects? I believe that this is not the case but I cannot be sure. I create the world with
world = new World(new Vector2(0,-10), true);
2 - Is my player object calculating its collisions with all the EdgeShapes on the world (and mostly getting negative results). I believe that this is the case as performance is low and I have never told it not to check for collisions with only a selection of the objects.
I doubt that 1 is true but I think that 2 is correct, therefore my questions on optimisation are how can I only check for collisions with my player box and EdgeShapes that are close by (each edgeshape is only 1m long). And are edge shapes the correct class to be using for my terrain in the first place?
Performance problems occur on Android btw.