Aether.Pyshics2d in slo mo

Hi everyone! I have a question related with Aether2d.
I have a simple bouncing ball with monogame 3.8 and Aether.Physics2D.MG 1.6.1
I have this simple code but the ball and the bouncing is VEEEEEEEERY SLOW.
I don’t want to change gravity value because as far as I know is in meters/seconds
Does anyone encountered the same problem? Here is my code:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using tainicom.Aether.Physics2D.Dynamics;

namespace BouncingBall
{
    public class Game1 : Game
    {
        Texture2D ballTexture;

        private GraphicsDeviceManager _graphics;
        private SpriteBatch _spriteBatch;
        Vector2 ballPosition;
        World world;
        Body ballBody;

        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            ballPosition = new Vector2(_graphics.PreferredBackBufferWidth / 2, _graphics.PreferredBackBufferHeight / 2);
            world = new World(new Vector2(0, 10f));
            ballBody = world.CreateCircle(64, 1, ballPosition, BodyType.Dynamic);
            ballBody.SetRestitution(0.9f);
            world.CreateEdge(new Vector2(0, 480), new Vector2(640, 480));
            base.Initialize();
        }

        protected override void LoadContent()
        {
            // TODO: use this.Content to load your game content here
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            ballTexture = Content.Load<Texture2D>("ball");
        }

        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Left))
                ballBody.ApplyLinearImpulse(new Vector2(-10f, 0));
            if (Keyboard.GetState().IsKeyDown(Keys.Right))
                ballBody.ApplyLinearImpulse(new Vector2(10f, 0));
            if (Keyboard.GetState().IsKeyDown(Keys.Up))
                ballBody.ApplyLinearImpulse(new Vector2(0, 10f));
            base.Update(gameTime);
            world.Step(gameTime.ElapsedGameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            _spriteBatch.Begin();
            _spriteBatch.Draw(ballTexture, ballBody.Position, Color.White);
            _spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}

Thank you!

Try it with: World.Step((float)gameTime.ElapsedGameTime.TotalSeconds);

I’ve already tried this (the first time) with the same outcome!
It’s a thing with 3.8?

It’s a matter of perspective. Consider that your ball is 128 meters wide -the size of a ferry ship- and hundreds of meters above the ground. Probably you are seeing it from several kilometers way.

You’re right! I had to implement a zoom system and that fixed it!

Thank you!

1 Like

Hi Saint, could you please provide sample code how you fixed this?
Thanks