Geometries not colliding?

Nov 15, 2009 at 4:35 AM
Edited Nov 15, 2009 at 4:41 AM

I'm fairly sure its something stupid I'm doing, but these geometries are not colliding.

I'm trying to use the border code from the advanced samples for some simple testing, that works fine. It draws fine and debug shows that its all good.

Then I create just any shaped geometry (I've chosen an ellipse).

Then the ellipse will fall through the border. I'm not sure what's causing it.

 

        public override void LoadContent()
        {
            simulator = new PhysicsSimulator(new Vector2(0, 200));
            simulatorView = new PhysicsSimulatorView(simulator);
            simulatorView.EnableEdgeView = true;

            levelBorder = new Border(800, 600, 20, new Vector2(400, 300));
            levelBorder.Load(ScreenManager.GraphicsDevice, simulator);

            Body b = Factories.BodyFactory.Instance.CreateEllipseBody(simulator, 30, 50, 30);
            Geom g = Factories.GeomFactory.Instance.CreateEllipseGeom(simulator, b, 30, 50, 50);
            b.Position = new Vector2(300, 300);

            simulatorView.LoadContent(ScreenManager.GraphicsDevice, ScreenManager.Game.Content);
            base.LoadContent();
        }

 

Do you know whats wrong?

 

Edit: Turns out the border was too thin? Even though it was 20px.

Coordinator
Nov 21, 2009 at 4:55 PM

The borders use automatically calculated distance grid cell size. Using borders of 20px might be too thin - however, if you supply your own distance grid cell size, you can use borders of 20px or even less.

The best thing to do is to create thick borders (to prevent tunneling out of the world) and then place the borders outside the view of the screen. We placed the borders inside the screen - simply to how that they are there. (and not something magical happens when you hit the screen border. :) )

Dec 14, 2009 at 6:57 PM

Ummm....I've got a question for you guys (sorry for bringing this old post back to life, but I didn't want to make yet another one). Since you use stuff from B2D, why not implement their CCD until you can come up with your solution? B2D has an excellent CCD and it runs great. You could implement that and optimize it. That would make Farseer usable for actual physics games. Right now, if I fall from too high up, even if my ground in thick, I sometimes pass through it...