FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Step Simulation Syncing

3 posters

Go down

Step Simulation Syncing Empty Step Simulation Syncing

Post  jj Sun Sep 28, 2008 4:52 pm

I have had some problems with tunneling and objects getting stuck and pushing through collision objects. After looking at the Bullet forums, I have found some resolution by scaling up the object sizes, and increasing the step simulation to 1/240

I now have a simulation that moves really slow (like its on the moon). There are several forum posts about the slow simulation issue. I'm a little confused on how the sio2 engine is rendering the frame rate, and how that frame rate relates to the bullet physics stepSimulation. And delta time? I'm not exactly sure where the delta time is indicated, or what exactly it means.

Any insights would be greatly appreciated...

edit: Additionally, if I want to begin the stepSimulation with physicPlay, how might I go about animating a smooth camera movement as the physic simulation plays out?

edit2: Does engine support the bullet btBvhTriangleMesh collision shape?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Step Simulation Syncing Empty Re: Step Simulation Syncing

Post  Admin Sun Sep 28, 2008 7:05 pm

I see, well if you don't think that the embedded mechanism for the physic simulation is adequate for your case you can always override it like that:


1. Comment the sio2PhysicRender in the drawview function (inside EAGLView.mm )

2. Place the following code somewhere in your rendering loop:

// Assuming that you want to use the current physic world bind to the sio2 handle...
if( sio2->_SIO2physic->state == SIO2_PHYSIC_PLAY )
{ sio2->_SIO2physic->_btDiscreteDynamicsWorld->stepSimulation( <whatever time you want>, <whatever # of steps you wnat> ); }


Et voila! Wink

Lemme know how it goes...

Admin
Admin

Posts : 10
Join date : 2008-08-26

http://forum.sio2interactive.com

Back to top Go down

Step Simulation Syncing Empty Re: Step Simulation Syncing

Post  jj Mon Sep 29, 2008 6:05 am

Sorry, my eyes hurt from trying to learn the engine all week long. I'm getting quite confused, but want to keep pushing through. I may have some basic/dumb questions at this point.

Could you explain this line in tutorial08:

/*This is basically just a hack, when the execution pointer reach here we just finish loading so basically frame rate is low (*how low?). We are tweaking it a little (*really? or just indicating a value to use at this point in loading?) to not have bullet going crazy and stepping into the simulation with a delta time of 1 or somehting */
sio2->_SIO2window->fps = 15;

From what I've figured, when I play physic this means the following method is being called (in sio2_physic.cc ?):

void sio2PhysicRender( SIO2physic *_SIO2physic,
SIO2window *_SIO2window )
{
if (!_SIO2physic) return;
if( _SIO2physic->state == SIO2_PHYSIC_PLAY )
{ _SIO2physic->_btDiscreteDynamicsWorld->stepSimulation( (btScalar)( 1.0f / _SIO2window->fps ), 0 ); }
}

Or: stepSimulation(1/15, 0)

And if I am assuming correctly, that means that the whole stepSimulation is (1/15, 0, 1/60) ?

I found this article which would suggest that instead of 0 for maxSubSteps, the value of 4 should be used here...
http://www.bulletphysics.com/mediawiki-1.5.8/index.php?title=Stepping_The_World

I've gone ahead and left it at 0.

I'm not sure what I've done since yesterday, but now when I first run physicPlay, my whole simulation runs as slow as possible and I see about 1 frame every 3 or 4 seconds. If I call physicReset after that, it plays ok.

Thoughts?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Step Simulation Syncing Empty Re: Step Simulation Syncing

Post  sio2interactive Mon Sep 29, 2008 7:00 am

(*how low?).

>> Near 1 fps, you are loading stuff sequentially taking almost 100% of the CPU and no sio2SwapBuffers have been called to update the frame delta time as well as the fps...

We are tweaking it a little (*really? or just indicating a value to use at this point in loading?)

>> Well yeah since the fps is really low Bullet is going to try to catch up and its going to end up that your geometry will just fall to the ground because the simulation step is too huge. 1 frame the object is at 0,0,10 and the other is at 0,0,-100 the physic steps should be executed on every frame to have a progressive translation established by the gravity etc...

And if I am assuming correctly, that means that the whole stepSimulation is (1/15, 0, 1/60) ?

I found this article which would suggest that instead of 0 for maxSubSteps, the value of 4 should be used here...

>> This perfectly right to put it at 4 on a PC but when you are going to run your app on the iPhone (the device) you'll see that the typical setting usually used by stepSimulation( 1/60, 4 ) (which is exactly what Im using on the 3D engine that Im developing at work that is running on PCs and the performance are great); will drastically slow down your app. That's why I tweak the value a little so I can have like a decent scene (like the one in the video on the homepage) running on an iPhone at minimum 15fps. Bullet have no support for fixed point at the moment only floats (and double but... that one forget it). Floats support is nice on the iPhone but using fixed will dramatically boost the performance of Bullet, you can always ask Erwin to do us a great favor and add fixed floating point support in Bullet Wink

http://www.bulletphysics.com


I'm not sure what I've done since yesterday, but now when I first run physicPlay, my whole simulation runs as slow as possible and I see about 1 frame every 3 or 4 seconds. If I call physicReset after that, it plays ok.

>> Nope sorry I never meant this problem... Maybe try to isolate the problem and send me a project that reproduce the bug (if any) so I can fix it.

Hope this help!

Cheers,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Step Simulation Syncing Empty Re: Step Simulation Syncing

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum