laymelek
laymelek

Reputation: 417

Box2d is working wierd after changing andengine resolution

i am having a really strange problem.. I have developing a game. I was using 480*800 camera resolution in andengine with 64*64pixel boxes with ptm=32 in box2d.

To have better graphics i increased the resolution to 720*1280. I replace all of my assets. Now using a box with 96*96pixel.

The problem is after increasing the resolution the physics behaviour changed. Its behaving wierd. Sometimes boxes are veeeery slowly sliding on each other althoug friction values are 1. Or they behave elasticly although restitution values are 0. And some swinging movements are converging. Rather than getting slowly and more stable they are getting stronger.

None of these problem exist when i am using 480*800 camera resolution

Please help me. I am going crazy for a while about it now

Upvotes: 0

Views: 46

Answers (1)

Pavel
Pavel

Reputation: 2564

Box2D manual says:

Box2D is tuned for MKS units. Keep the size of moving objects roughly between 0.1 and 10 meters. You'll need to use some scaling system when you render your environment and actors. The Box2D testbed does this by using an OpenGL viewport transform. DO NOT USE PIXELS.

So, check if size of your bodies in METERS, forget about pixels. Setup you ptm to match requirement, described in manual.

Upvotes: 1

Related Questions