weird simulation
Posted: Fri Feb 20, 2015 8:34 am
Hi....
... so... i've been dealing with box2d problem for a while now. I cant get pass this point, so i hope someone can help me.
I've created simple scene in RUBE editor, export it via json, import it in my game and renderd it with Polycode game engine. (I'm using OSX 10.10 btw)
Objects appear to move and rotate correctly, everything seems to work just fine. At this point im positive, that im drawing and updating my sprites corretly.
But... if I build more complex scene (multiple joints, bodies...) ... still everything works fine in RUBE editor simulation.
If i import this scene to my game, strange things begin to happen. Bodies connected to joints begin to act weird. Simulation just isnt right. Outcome is completely different, than the one in RUBE editor (RUBE editor simulation is perfect). If i make bodies as bullets, then simulation gets realy realy weird. Sprites begin to have invisible edges, they begin to stuck in eachother, weld joints dont keep up....
I should mention, that the time step, iterations, gravity... are the same in my game and in rube editor. And ofcourse i use fixed time step.
Here are the other things that i tried, without success:
- different box2d versions + liquidfun version
- recompile box2d with different optimizations
- export scene to raw cpp file
- multiple different steps per second and iterations ( results vary, but there is allways a lot worse precision in my game)
In a week or so, i will try to see if i have same problem on a Linux PC...
I'm desperate at this point... so... if someone has a clue, what might be going on.. please help.
best regards to you all,
Klemen
... so... i've been dealing with box2d problem for a while now. I cant get pass this point, so i hope someone can help me.
I've created simple scene in RUBE editor, export it via json, import it in my game and renderd it with Polycode game engine. (I'm using OSX 10.10 btw)
Objects appear to move and rotate correctly, everything seems to work just fine. At this point im positive, that im drawing and updating my sprites corretly.
But... if I build more complex scene (multiple joints, bodies...) ... still everything works fine in RUBE editor simulation.
If i import this scene to my game, strange things begin to happen. Bodies connected to joints begin to act weird. Simulation just isnt right. Outcome is completely different, than the one in RUBE editor (RUBE editor simulation is perfect). If i make bodies as bullets, then simulation gets realy realy weird. Sprites begin to have invisible edges, they begin to stuck in eachother, weld joints dont keep up....
I should mention, that the time step, iterations, gravity... are the same in my game and in rube editor. And ofcourse i use fixed time step.
Here are the other things that i tried, without success:
- different box2d versions + liquidfun version
- recompile box2d with different optimizations
- export scene to raw cpp file
- multiple different steps per second and iterations ( results vary, but there is allways a lot worse precision in my game)
In a week or so, i will try to see if i have same problem on a Linux PC...
I'm desperate at this point... so... if someone has a clue, what might be going on.. please help.
best regards to you all,
Klemen