Bullet in seperate thread

do0mbringer
Posts: 1
Joined: Sun Feb 22, 2009 12:32 am

Bullet in seperate thread

Post by do0mbringer »

Hello, I currently have it set up so that bullet is operating in its own thread, at a fixed time step of 1/100. However, due to the way bullet handles its own interpolation I am having graphical hiccups when operating at a very fast fps as the rendering thread doesn't get to handle its own interpolation. I see that it is generally frowned upon to use a stepSimulation(dt,0). But in this case dt is a fixed time-step so I think its basically the same thing that bullet does internally. My main question is, if I use bullet this way with dt being fixed and passing a 0 as the second argument, does it still report the final position to MotionStates so I could handle the interpolation myself? Thanks.
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: Bullet in seperate thread

Post by projectileman »

A curious thing about MotionStates and synchronization is that a method synchronizeMotionStates() is called several times on a simulation step, one per each substep iteration. Look at the line 357 on file btDiscreteDynamicsWorld.cpp . Why don't just call synchronizeMotionStates() only when the entire step has been finished?

Also look at the line 266, the expression //if (body->getActivationState() != ISLAND_SLEEPING) has been commented... why?
Now bullet sends all the entire dynamic bodies to the graphics part, even if some of them haven't change their positions or are sleeping.