Working perfect on simulator not working on device

Official forum for the Chipmunk2D Physics Library.
Post Reply
mrigankgupta
Posts: 2
Joined: Mon Oct 24, 2011 10:52 pm
Contact:

Working perfect on simulator not working on device

Post by mrigankgupta »

This is my first post on this forum, so first of all thanks for making this awesome engine.
now comes to the question part, I am making a small sample on iOs. in my sample I am dropping a balls with gravity cpv(0,-10). It is working fine on simulator but on device ball doesn't fall and remain still on the same place.
what can be the problem, any idea on this.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Working perfect on simulator not working on device

Post by slembcke »

There shouldn't be any problems with Chipmunk itself between the two. I suspect your update loop isn't getting called. Try putting a NSLog() statement where you step the space and see if it ever gets called.

Can you share any more information about how your game is set up?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
mrigankgupta
Posts: 2
Joined: Mon Oct 24, 2011 10:52 pm
Contact:

Re: Working perfect on simulator not working on device

Post by mrigankgupta »

I figured it out.. it was because I was calling cpSpaceStep with very small update time. actually my gameloop settings are different on simulator and device so now its fine. my next question is .. for ideal gravity (cpv (0,-10)) situation what might be timeInterval of game cpSpaceStep update for device (or generally right now I am updating 1/60 sec) .. anyways thanks for help :)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Working perfect on simulator not working on device

Post by slembcke »

1/60th of a second is good. If you have faster moving objects you might need a smaller one. You should always use a fixed size timestep though instead of the amount of time that has passed since the last frame. This is a good article about why: http://gafferongames.com/game-physics/f ... -timestep/
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests