Page 1 of 1

Linear acceleration

Posted: Thu Jan 11, 2018 7:42 am
by box
Each iteration I call method "body.applyForce(new Vec2(10, 0), new Vec(0, 0));"

I expect that after each iteration body linear speed will be increased to appropriate value, and position will be look like
step 1: speed is (0, 0), position is (0, 0)
step 2: speed is (1, 0), position is (1, 0)
step 3: speed is (2, 0), position is (3, 0)
step 4: speed is (3, 0), position is (6, 0)
step 5: speed is (4, 0), position is (10, 0)

But instead of it, I got this output:
step 1: speed is (0, 0), position is (0, 0)
step 2: speed is (1, 0), position is (1, 0)
step 3: speed is (1, 0), position is (2, 0)
step 4: speed is (1, 0), position is (3, 0)
step 5: speed is (1, 0), position is (4, 0)

Why it happen, and how I can solve my problem?
ps also, I set world.setAutoClearForces(false); but nothing was changed.

Re: Linear acceleration

Posted: Thu Jan 11, 2018 1:10 pm
by box
Hm, I found this code inside or "Island" class:

Code: Select all

if (translationx * translationx + translationy * translationy > Settings.maxTranslationSquared) {
        double ratio = Settings.maxTranslation
            / MathUtils.sqrt(translationx * translationx + translationy * translationy);
        v.x *= ratio;
        v.y *= ratio;
      }

This part make my body move slowly than I need. Anybody know, why it was used for?