I'm writing a top down racing game. A quick anatomy of the game is: The "car node" moved by setting the physicsBody velocity in update method (i wanna set velocity of the physicbody and not the position because i wanna retrive the velocity value of the car object anywhere in the game...), so this is the car movement:
float dx=JoyPadRelativePosition.x*_maxSpeed;
float dy=JoyPadRelativePosition.y*_maxSpeed;
[self.car.physicsBody setVelocity: CGVectorMake(dx,-dy)];
At the same time in didSimulatePhysics i move the _worldNode to leave the car always in the center of the screen:
CGPoint target = [self pointToCenterViewOn:self.car.position];
CGPoint newPosition = _worldNode.position;
newPosition.x += (target.x - _worldNode.position.x);
newPosition.y += (target.y - _worldNode.position.y);
SKAction *actionMove = [SKAction moveTo:newPosition duration:0.4];
[_worldNode runAction:actionMove];
With this code the movement of the background and the movement of the car works correctly and smoothly in Ipad2 and iphone5 at 60 fps. The problem comes with iphone4, with this device the background jitter and global fps decreses to 40 fps. Reading stackOverflow questions and some blogs i have found a solution, limit the global fps to 30 (in this way i can be sure that all device will run at the same rate).
_skView.frameInterval=2;
With this setting anyway my background jitters in Ipad2,iphone5 and Iphone 4 (all real devices). Why? I have to modify something in my code due the new standard 30 fps rate?