This project has moved. For the latest updates, please go here.

Debug.Assert(ContactCount < _contactCapacity); 3.2

Jul 17, 2011 at 10:18 PM

Hi i'm now using farseer 3.2 and i'm getting an error from class Islands.cs from the line: Debug.Assert(ContactCount < _contactCapacity);

Can anyone tell me what this means? What might be causing it? is this common?

For refference, this error is thrown when i create bullet objects of class Bullet like this:

Vector2 bulletPos = Vector2.Zero;
            bulletPos += new Vector2(300, 200);
            float rotation = circleBody.Rotation;
            Vector2 Pos = ConvertUnits.ToSimUnits(bulletPos);

            Bullet b = new Bullet(bulletTex,
                new Vector2(20, 0),


and class Bullet looks like this:

class Bullet
        #region Variables
        public Body bulletBody;
        public Fixture bulletFixture;
        Vector2 bulletOrigin;
        Texture2D bulletTex;
        Vector2 velocity;

        public Bullet(Texture2D bulletTex, Vector2 position, float rotation, Vector2 velocity, Game1 parentGame)
            this.bulletTex = bulletTex;
            this.bulletOrigin = new Vector2(bulletTex.Width / 2, bulletTex.Height / 2);
            this.velocity = velocity;

            bulletFixture = FixtureFactory.CreateRectangle(, bulletTex.Width, bulletTex.Height, 1);
            bulletFixture.Friction = 0;
            bulletFixture.Restitution = 0;
            bulletBody = bulletFixture.Body;
            bulletBody.BodyType = BodyType.Dynamic;
            bulletBody.IsBullet = true;
            bulletBody.Position = position;
            bulletBody.Rotation = rotation;

            bulletBody.LinearVelocity = velocity;

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
            Vector2 position = ConvertUnits.ToDisplayUnits(bulletBody.Position);


I've not had this problem until now and i've happily been creating working objects in lists from my tile engine.

Jul 18, 2011 at 5:20 PM
Edited Jul 18, 2011 at 5:21 PM

I'd appreciate it if someone could even just tell me what ContactCount and _contactCapacity are?

Jul 18, 2011 at 6:44 PM

Ok then, i finally managed to work out this problem. I believe the contact problem was occuring because the object was undergoing too many collisions. The problem was i'd forgotten to use ConvertUnits on the width and height of the fixture.