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

Attach two circle fixtures

Topics: User Forum
Mar 14, 2011 at 5:06 PM

I got two circle fixture's:

Circle 1 has a radius of 2f, and is a dynamic rolling object.

Circle 2 has a radius of 1f, and is a static object attached to circle 1's top.

Circle 1 rolls with circle 2 attached to its top, making circle 2 stick out. Once circle 1 eventually has rolled far enough for circle 2 to hit the ground, circle 2 must simply go under the ground, ignoring the collision while continuing to follow the rolling circle 1.


Does anyone know how I can achieve that given scenario?

Mar 15, 2011 at 9:04 AM

If I understood well your explanation, circle 2 shouldn't be static (static objects in Farseer can't move). Make circle 2 dynamic, attach it to circle 1 with a weldjoint, and set CollisionCategories and CollidesWith properties to 'Category.None', so circle 2 doesnt collide with anything. Then apply an angular impulse to the circle 1 to see it rolling with the circle 2 attached.

Mar 15, 2011 at 11:44 AM


Thanks a lot, got it working :D, was using the wrong joint and didn't know about the collision categories:


Body body = BodyFactory.CreateBody(World, new Vector2(-15f, 6f));
            _circle1 = FixtureFactory.CreateCircle(2, 1, body, material);
            _circle1.Body.BodyType = BodyType.Dynamic;
            _circle1.Restitution = _restitution;
            _circle1.Friction = 0.5f;
            _circle1.Body.Position = _position;

            Body body2 = BodyFactory.CreateBody(World, new Vector2(-15f, 6f));
            _circle2 = FixtureFactory.CreateCircle(1, 1, body2, material);
            _circle2.Body.BodyType = BodyType.Dynamic;
            _circle2.Restitution = _restitution;
            _circle2.Friction = 0.5f;
            _circle2.Body.Position = _position;
            _circle2.CollisionFilter.CollisionCategories = Category.None;
            _circle2.CollisionFilter.CollidesWith = Category.None;

            WeldJoint weldJoint = new WeldJoint(_circle1.Body, _circle2.Body, new Vector2(0, 5), new Vector2(0, 3));
            weldJoint.CollideConnected = false;
Works like a charm
Mar 15, 2011 at 1:33 PM

Good to hear (well, read) that :)