Search code examples
libgdxbox2dlightbox2dlights

Libgdx || Box2D Body frustum Culling?


Im currently developing a little dunguen crawler and because i only got about 200 fps on desktop i really need to fix my code :). My game uses a algorithm for creating different levels with different rooms and so on. Because rooms got walls, i loop trough them and create bodys. On a 50x50 map there plenty of bodies now and all are calculated and rendered on the same time :(. I also use Box2d Lights and the rayhandler for creating shadows, every body casts shadows :)

Is there a way to implement frustum culling ? And if yes how :) Any code samples? Are there any other ways to improve the fps rate on bodys ?

Thank you for your time and attention :)


Solution

  • I know this question is a bit old. But it appears to be the first hit concerning frustum culling with box2d and / or libgdx. And as I created a tutorial to that I wish to post it here, may future people in need can use it

    http://erqdev.com/2017/02/26/frustum-culling-with-box2d/