circle continue falling under the floor

Jul 10, 2011 at 12:59 AM

hi there, 

i have problem in cercle when it fall under the gravity , it continue falling under floor and it disapear i dont know why ??

this  is the code :

 

 texture = Content.Load<Texture2D>("circleSprite");     

groundTexture = Content.Load<Texture2D>("groundSprite");           

myWorld = new World(Vector2.UnitY * 10);                              

Fixture floorFixture = FixtureFactory.CreateRectangle(myWorld, ConvertUnits.ToSimUnits(480), ConvertUnits.ToSimUnits(20), 10);           

floorFixture.Restitution = 0.5f;           

floorFixture.Friction = 0.5f;         

  floorBody = floorFixture.Body;         

  floorBody.IsStatic = true;                    

   boxBody = BodyFactory.CreateBody(myWorld);           

FixtureFactory.CreateRectangle(myWorld, ConvertUnits.ToSimUnits(98), ConvertUnits.ToSimUnits(98), 10, Vector2.Zero, boxBody);           

foreach (Fixture fixture in boxBody.FixtureList)            {                fixture.Restitution = 0.5f;                fixture.Friction = 0.5f;            }           

boxBody.BodyType = BodyType.Dynamic;

 floorBody.Position = ConvertUnits.ToSimUnits(new Vector2(240, 700));           

boxBody.Position = ConvertUnits.ToSimUnits(new Vector2(240, 25));         

 

and this is the draw method :

spriteBatch.Begin();         

  spriteBatch.Draw(texture, new Rectangle((int)(ConvertUnits.ToDisplayUnits(boxBody.Position.X) - 49),(int)(ConvertUnits.ToDisplayUnits(boxBody.Position.Y) - 49), 98, 98), Color.Green);

   spriteBatch.Draw(groundTexture, new Rectangle((int)ConvertUnits.ToDisplayUnits(floorBody.Position).X - 240,  (int)ConvertUnits.ToDisplayUnits(floorBody.Position).Y - 32, 512, 64), null, Color.Gray,  floorBody.Rotation, new Vector2(0, 0), SpriteEffects.None, 0);           

spriteBatch.End(); 

 

Nb: i use a texture circle size 98*98   and floorTexture 512*46

 

 

thanks all the people here