🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to make the bullet physics update faster?

Started by
1 comment, last by Dirk Gregorius 6 years, 6 months ago

My bullet physics simulation works very slowly. Let's say, one of the objects is lifting the other one, the takes many many many frames to update to the correct position. Just very laggy...

Can I increase the dt? or decrease it, to make the physics react better?

 

The fact is I use the gimpact shapes for the forks of the forklift, I can't decompose the forks into many boxes, it's too time consuming...

So I have one 4 bvh static mesh, 8 gimpacts, about 10 boxes...

Thanks

Jack

 


	l_dynamicsWorld->stepSimulation(dt,100,dt/100);
	
Advertisement

This looks to me as if you are taking 100 sub-steps per tick which would indeed be very slow. Usually you pick a fixed time-step like 30, 60, 120, or even 240 Hz and a fixed number of sub-steps. For games 30 or 60 Hz is a typical choice. 


const int MaxSubSteps = 4
const float FixedTimeStep = 1.0f / 60.0f; // Or similar

pDynamicsWorld->stepSimulation( dt, MaxSubSteps ,FixedTimeStep );

I recommend checking out Glenn's post here:

https://gafferongames.com/post/fix_your_timestep/

And the Bullet Wiki:

http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World

You also posted a bunch of other questions regarding dynamic mesh shape (GImpact) collision. This is usually slow since this is just a very difficult problem. I would not use GImpact shapes in real-time simulations. Use simple hulls or compounds instead.

This topic is closed to new replies.

Advertisement