Xerusial
Xerusial

Reputation: 572

realistic jumping box2d - configuration of variables

I'm still working on my Jump 'n' Run and have already solved the "can I jump" question.

My Question is now, how should I configure the Gravity, the Timesteps, the Fixturesize, the applied Impulse and the Fixturedensity for the most realistic result?.
The Fixturesize is now at 230x140 and can't be changed cause I need the pixelexact size for debugging. What can be changed is:

Gravity(10),

Timesteps(Deltatime*4);

applied Impulse(1000000);

Fixturedensity(0,002);

And why do I need an Impulse of 1 (!) million to move a current mass of 65kg?

Upvotes: 0

Views: 487

Answers (1)

Daniel Murphy
Daniel Murphy

Reputation: 882

Please do not use pixelexact sizes, this will make the engine perform and act poorly. It's in mks (meters-kilograms-seconds). A 230x140 meter object is a little large. Also object speed is capped at around 200 m/s, so you won't get that moving very fast. If you need help with transforming, take a look at the OOBViewportTransform class, which is provided in the common package.

The impulse and density only matter in relation to other objects. So you might want to create a level first, and then test how your character interacts. Starting with densities of 1 is usually fine. You generally don't want to make either too high.

Upvotes: 1

Related Questions