Glitch with Revolute Joints

General discussion about the R.U.B.E editor
Post Reply
skinwalker
Posts: 14
Joined: Sat Jun 21, 2014 1:19 pm

Glitch with Revolute Joints

Post by skinwalker »

Hello,
I finally ran my Rube project with AndEngine on my android device.I have 2 caves connected with a bridge ( I used this tutorial to create my bridge with revolute joints http://youtu.be/WqLR4dFn1qE ).So when I start my project sometimes the joints break here is a picture of my bridge

Image

Here is a picture of the same bridge when the glitch engaged

Image

The glitch appears when I tap on the screen before the scene is loaded and I don't have a splash scene,because this is my test project.So what do you think? What may cause the glitch ?
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Glitch with Revolute Joints

Post by iforce2d »

Honestly I have no idea just from looking at a picture. Are you using a fixed time step?
skinwalker
Posts: 14
Joined: Sat Jun 21, 2014 1:19 pm

Re: Glitch with Revolute Joints

Post by skinwalker »

When I pause my game and then resume it all of the joints (even wheel joints) break and I have no idea why :?
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Glitch with Revolute Joints

Post by iforce2d »

Are you using a fixed time step?
skinwalker
Posts: 14
Joined: Sat Jun 21, 2014 1:19 pm

Re: Glitch with Revolute Joints

Post by skinwalker »

I am a beginner and honestly I have no idea what this is.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Glitch with Revolute Joints

Post by iforce2d »

When you step the physics world, usually you give a time length for the step. If your game runs at 60fps, usually the time length will be 1/60 second. For example, in C++ the call to step the world would be like this:

world->Step( 1/60.0, velocityIterations, positionIterations);

That would be a fixed time step, because it always uses the same constant length (1/60 second). The other way you can do it, is with a variable-length time step, where you measure how much time (real world time) has passed since the last step was done, and use that as the length of the time step. This is a bad idea for many reasons, which you can read about by googling something like "fixed time step vs variable time step".

If you are using a variable time step, I would expect to see big problems like those you describe, because the time passed between pausing the game and restarting would be much longer than 1/60 second, so you might be simulating a very long time in one step.
Post Reply