Changing Radius of Existing Fixture

May 16, 2010 at 11:35 AM

Thanks for all the work y'all are doing on this. I'm really excited about FP3.0, which I'm using for my current project.

I'm confused about how I should be using pools. If my game has many circle objects of random radius, will a body/fixture pool help if I can't get a pre-built Fixture of any radius? I tried changing the radius of the Fixture's CircleShape on the fly, and it worked sometimes. But after increasing the radius 2 or 3 times it stopped working. I guess this problem isn't exclusive to circles. The advantage of using a resource pool is that I don't have to create or destroy any objects during gameplay. But if I can't change the shape of those objects than it isn't very useful, right?

I can fill my pool with Fixtures of several different radii, and get one closest to what I need, but that is not ideal. The box2d documentation mentions circle-circle and circle-polygon specific collisions but doesn't really go into detail. If that's in Farseer then changing the radius of a Fixture's CircleShape shouldn't cause any problems right?

Thanks for any clarification anyone can provide.

May 17, 2010 at 5:37 PM
Changing the radius of a circle should work. I've not tested it, but since we are using SAT for the narrow phase collider, it creates no overhead of creating/changing bodies on the fly. Can you explain what you mean by "it stopped working"?
May 19, 2010 at 7:03 AM

It stopped working, meaning the fixture would not get bigger when I increased the radius. Though I now realize that the problem is related to the new scale of FP3. My circle had a radius of 80, which in meters is way too big. I modified a testBed sample and it works just as it should. This scaling is very confusing to me. Upgrading from 2.x is a lot more involved than I thought it would be. Oh well, its giving me a much deeper understanding of Farseer.