Mass, density and gravity

Topics: Developer Forum, User Forum
Jul 20, 2011 at 6:07 PM

I would like to develop a project based on the severity where the various objects have different masses and therefore should have different behaviors.

I have made ​​some attempts, but it seems that the mass does not affect the behavior of gravity.

Example.
I took the sample between SimpleDemo8.cs and I changed to this:

public override void LoadContent()
        {
            base.LoadContent();

            World.Gravity = new Vector2(0f, 10f);

            _border = new Border(World, this, ScreenManager.GraphicsDevice.Viewport);

            Vector2 _position = new Vector2(-15f, -8f);
            float _restitution = 0f;


            _circle[0] = BodyFactory.CreateCircle(World, 1.5f, 1f, _position);
            _circle[0].BodyType = BodyType.Dynamic;
            _circle[0].Restitution = 0.5f;
            _position.X += 6f;

            _circle[1] = BodyFactory.CreateCircle(World, 1.5f, 0.1f, _position);
            _circle[1].BodyType = BodyType.Dynamic;
            _circle[1].Restitution = 0.5f;
            _position.X += 6f;

            _circle[2] = BodyFactory.CreateCircle(World, 1.5f, 10f, _position);
            _circle[2].BodyType = BodyType.Dynamic;
            _circle[2].Restitution = 0.5f;
            _position.X += 6f;

            _circle[3] = BodyFactory.CreateCircle(World, 1.5f, 1f, _position);
            _circle[3].BodyType = BodyType.Dynamic;
            _circle[3].Restitution = 0.5f;
            _circle[3].Mass = 20;
            _position.X += 6f;

            _circle[4] = BodyFactory.CreateCircle(World, 1.5f, 1000f, _position);
            _circle[4].BodyType = BodyType.Dynamic;
            _circle[4].Restitution = 0.5f;
            _circle[4].Mass = 20;
            _position.X += 6f;

            _circle[5] = BodyFactory.CreateCircle(World, 1.5f, 0.1f, _position);
            _circle[5].BodyType = BodyType.Dynamic;
            _circle[5].Restitution = 0.5f;
            _circle[5].Mass = 20;
            _position.X += 6f;



            // create sprite based on body
            _circleSprite = new Sprite(ScreenManager.Assets.TextureFromShape(_circle[0].FixtureList[0].Shape,
                                                                             MaterialType.Waves,
                                                                             Color.Brown, 1f));
        }

All the balloons behave the same when they fall and bounce.

Someone can explain?

Jul 20, 2011 at 7:55 PM
Edited Jul 20, 2011 at 7:59 PM

Well, in real life mass does not affect gravity. So, what did you spect to happend?

Jul 20, 2011 at 8:28 PM

Excuse my ignorance.

I knew that the mass determines the dynamic behavior of objects when subjected to the influence of external forces, believed that the mass allowed me to manage the different objects fall.

Then I'm reminded of Galileo

http://en.wikipedia.org/wiki/Equations_for_a_falling_body.

now I must find a way to handle the friction of the fluid

Jul 21, 2011 at 8:15 PM

Try linear damping. Applying it to each body means they will fall and react differently to the same forces. Gives the impression of resistance. You can also use rotational damping to do a similar effect with things spinning.