Thanks for your replies! The game now runs "nearly" always as I expected... However sometimes (rarely, but existing) in the 1G iPhone physics still have some bugs. The problem is that I don't know how can I get my last used system to work, because my timer variables give me really high values, and I don't know how to make a relationship between them and the physics interval... Here is my code:
Code: Select all
float newTime = CFAbsoluteTimeGetCurrent();
float deltaTime = newTime - currentTime;
currentTime = newTime;
accumulator += deltaTime;
int count = 0;
int maxCount = 10;
if (accumulator < intervalFisica) {
accumulator = intervalFisica;
}
while ( (accumulator >= intervalFisica) && (count < maxCount) ) {
cpSpaceStep(space, intervalFisica);
accumulator -= intervalFisica;
count++;
}
cpSpaceHashEach(space->activeShapes, &eachShape, nil);
cpSpaceHashEach(space->staticShapes, &eachShape, nil);
[self updateScene:delta];
My time getter functions (CFAbsoluteTimeGetCurrent) give me values like "295193824.000000", which I think are really higher than those I need. is there any way to get just a seconds or milliseconds precision? Though the game runs well relating the delta time (as I exposed in my last post) sometimes it fails in the 1G so, if I can solve it, I want to...
Thanks for your help!