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

dynamic passing through static body

Topics: Developer Forum
Jan 21, 2015 at 8:19 PM

i'm new to Farseer and try to develop a 2D game with XNA. But i have a problem, I create a floor, as a static body (bodySol), and a square as a dynamic body. When i launch the game the square fall on the floor, perfect. But when i want to go right, at mid x axis the square fall through the floor, but the floor texture is still here. I noticed that when i'm going to the left, i'm not falling (when the square is out of the window), where the floor is supposed to stop at the window's edges. Here's my Load content:

bodyCarre = BodyFactory.CreateRectangle(world, sizeCarre.X * pixelToUnit, sizeCarre.Y * pixelToUnit, 1);
            bodyCarre.BodyType = BodyType.Dynamic;
            bodyCarre.Position = new Vector2(15 * pixelToUnit, 15 * pixelToUnit);

            bodySol = BodyFactory.CreateRectangle(world, sizeSol.X * pixelToUnit, sizeSol.Y * pixelToUnit, 1);
            bodySol.BodyType = BodyType.Static;
            bodySol.Position = new Vector2(0, (GraphicsDevice.Viewport.Height - sizeSol.Y) * pixelToUnit);
And my Draw content:
            spriteBatch.Draw(textureCarre, bodyCarre.Position * unitToPixel, Color.White);
            spriteBatch.Draw(textureSol, bodySol.Position * unitToPixel, Color.Black);