Disposing Geoms and Bodies causes lag..

May 10, 2010 at 5:54 PM

Has anyone ever had any problems with calling the Dispose method for Geoms and Bodies? It seems like after I remove around 20 geom/body pairs, my game lags terribly.

May 11, 2010 at 1:15 PM
Edited May 11, 2010 at 1:18 PM

I'm not 100% sure but if I remember correctly you should either use a reusable-pool for the geom and bodies (see documentation chapter Performance point 5  http://www.farseergames.com/storage/farseerphysics/Manual2.1.htm#_Toc213068514) or disable the bodies instead of disposing them and then dispose them when you enter the next level instead of every update-cycle. Worked for me.