This project has moved and is read-only. For the latest updates, please go here.

How To: Temporarily Disable Fixtures?

Oct 11, 2010 at 3:57 PM

Farseer 2.x used to have Geometry.CollisionEnabled.

Oct 11, 2010 at 7:54 PM
Edited Oct 11, 2010 at 8:23 PM

Body.Active = true/false should do it.

But there's also Body.Awake and Fixture.CollidesWith = CollisionCategory.Whatever... where whatever could be cat1-10, All, None. Guess it depends on what exactly you want to do.

Oct 11, 2010 at 8:47 PM

That's really weird. I made a much longer post this morning but only the first line got submitted? Bugs with new lines, maybe?

At any rate, I wanted to retain the properties of a dynamic body while enabling/disabling some fixtures. It seems like the proper way to do it would be to actually remove them from the body.fixtures list. 

As a visual example, lets say I've got some flying object and I wanted to give a circular shield. In 2.x I would do this by turning the geometry on and off. 

Oct 11, 2010 at 9:10 PM
Edited Oct 11, 2010 at 9:11 PM

I'm pretty sure that shield thing can be done with Body.Active. Right now I'm doing the same thing w/projectiles... setting Body.Active to false after collision or a certain distance traveled (this way I can go back and reuse them without having to instantiate new objects). When I have debug view on while doing this, I see the geometry fly through the air and then become inactive so my player can now travel through it as if it's not there. But if I'm completely wrong, sorry. Relatively new to farseer, but finally starting to get the hang of the basics.