Bullet Ogre3d integration btMotionState

sted
Posts: 3
Joined: Mon Jun 21, 2010 8:43 pm

Bullet Ogre3d integration btMotionState

Post by sted »

HI all,
this is my first post and first of all i want to thank all the bullet staff for such a great tool and all the forum for the support.

i've installed bullet 2.76 SDK because i wanted it to manage physics for a graphical application that uses ogre3d rendering engine
(by now it's just a cube....but it works :-) )

What i dont understand is that bullet has to call each tick/frame dynamicsWorld->stepSilmulation() , but ogre has its own loop:

Code: Select all

 int main(int argc, char *argv[])
 {
    // Create application object
    CubeApplication  app;
    try {
       app.go();
    } catch( Ogre::Exception& e ) {
 
    std::cerr << "An exception has occured: " <<
        e.getFullDescription().c_str() << std::endl;
    }
 
    return 0;
 }
and when app.go() gets called, it returns only when the application is exiting.

So where should i call stepSimulation() ?

i read that btMotionState is the connection between bullet and ogre, overriding getWorldTransform() and setWorldTransform(),
but where i have to call these ?

I though about making an Ogre FrameListener that each frame calls stepSimulation() and MotionState::getWorldTransform() and MotionState::setWorldTransform().
Am i wrong ? (i bet i am)

my goal by now is to have the motion of a cube(ogre mesh) driven by bullet dynamics
i would be very glad if you could point me in the right direction.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bullet Ogre3d integration btMotionState

Post by Erwin Coumans »

So where should i call stepSimulation() ?
You might want to ask this question in the Ogre forums. There is some example code integrating Ogre and Bullet in the OgreKit project:

http://code.google.com/p/gamekit/downloads/list

When calling 'stepSimulation' it will automatically update the motion state when necessary.

Thanks,
Erwin
sted
Posts: 3
Joined: Mon Jun 21, 2010 8:43 pm

Re: Bullet Ogre3d integration btMotionState

Post by sted »

i will look there
When calling 'stepSimulation' it will automatically update the motion state when necessary.
i will keep in mind this.


Thank you!
sted
Posts: 3
Joined: Mon Jun 21, 2010 8:43 pm

Re: Bullet Ogre3d integration btMotionState

Post by sted »

I found this thread about this problem:

http://www.ogre3d.org/forums/viewtopic.php?f=5&t=53292

it seems that you have to call stepSimulation() from inside the frameStarted() method of your FrameListener.