World Scale and Frame Sync Issues

jackjohnson
Posts: 8
Joined: Tue Sep 23, 2008 10:07 am

World Scale and Frame Sync Issues

Post by jackjohnson »

Hi,

I am having some trouble displaying a perceived "real time" physics animation.

I might be missing something basic, because it's a simple sphere object moving through space.

icoSphere with radius 2.25
mass = 2.7
gravity = -10

I want to move in the X-direction of 240 world units. Of course gravity will be applied so there is a horizontal component as well. The "ball" arcs upwards and falls to the ground covering approx. 100 world units in the Z-direction.

Here is the way my rendering is set up:

-iPhone EAGLView animationInterval = 1./25.
-fixed time step = 1./60.
-maxSubSteps = 2

When playing with these variables, I get different results, but none that simulate anywhere near "real-time".

Can anyone offer any suggestions for rendering this simple simulation (iPhone) ? or anything I may be missing or forgetting about?

Thanks in advance
bengarney
Posts: 3
Joined: Mon Dec 22, 2008 4:31 am

Re: World Scale and Frame Sync Issues

Post by bengarney »

I think with maxSubSteps 2 and fixedTimeStep 60Hz, but a framerate of only 25Hz, you won't be able to run in realtime. Specifically, if you are updating before each frame, then you will give it 25 opportunities per second to update. It will always be behind so will always do the max sub steps, so 2 ticks per frame. That's only a 50hz update rate, meaning you'll run at 83% realtime.

Does that seem consistent with your slowdown, or is it much slower than that?