Demos are 10x slower than the real world

Post Reply
sftrytry
Posts: 1
Joined: Wed Jan 09, 2013 12:39 am

Demos are 10x slower than the real world

Post by sftrytry »

I compiled bullet 2.81 on archlinux. Some or all demos are 10x slower than the real world. They are like slow motions.

As I googled, it might have some thing to do with the "m_dynamicsWorld->stepSimulation" function.

I could make the Demos more realistic with 10x gravity -98 instead -9.8 or "m_dynamicsWorld->stepSimulation(ms / 10000.f, 10)" instead of 1000000

Any ideas?

Btw, I tested bullet in blender game engine. It is also "slower". Or I have a really bad sense of the real world physics?
Nickert
Posts: 25
Joined: Sat Dec 29, 2012 7:20 pm

Re: Demos are 10x slower than the real world

Post by Nickert »

It's easy enough to calculate the time it takes for a box to drop 10 meters, you can test this in Bullet as well, modify HelloWorldExample a bit..
d3x0r
Posts: 51
Joined: Tue Dec 11, 2012 9:59 pm

Re: Demos are 10x slower than the real world

Post by d3x0r »

it all actually pretty realistic because the objects are actually really big given that a unit of 1 is 1 meter; In my current simulation gravity is set at 9800.0 which is mm, and all of my objects are ping ping balls at like 44mm.

but when it was at 9.8 it was really slow, but then I realized that's because I was looking at something like 1km (15*75m) tall thing that was falling. Even the world trade center was only like 400m. a 44m ball with some space inbetween... heh kinda like dropping VW bugs off WTC and having them bounce back all the way back up


Hmm was thinking, since the time is squared, and the distance is * 1000; 10*10 is 100... so 31.16 times slower... so probably 3 times slower than you think it is? I dunno depends, should calculate how big your things actually are... and how big you think they are. if they're 10x10x10 cubes youre thinking are 1x1x1 ... ?
labidus
Posts: 7
Joined: Sun Aug 25, 2013 12:40 am

Re: Demos are 10x slower than the real world

Post by labidus »

they are a bug with the timing function, to get a correct gravity on my system (windows8) i need to put a gravity of -9.81 * 100.0f in the world to get a good gravity. (I use GCC with code::blocks)

Its maybe because I use C++x11 standard, i know they are a bug with the chronos lib, i use boost because of this bug, do you use chronos for timing?

Or its related to something else, I was not able to build the demo with code blocks, so many problems while building, so I endup downloading the exe to test them and they are fine, they are probaly build with ms tool not gcc with the timing bug...
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Demos are 10x slower than the real world

Post by Basroil »

sftrytry wrote:I could make the Demos more realistic with 10x gravity -98 instead -9.8 or "m_dynamicsWorld->stepSimulation(ms / 10000.f, 10)" instead of 1000000
step simulation function takes an argument of seconds, and if your ms variable is in milliseconds, then you have your problem right there, the division should be by 1000 rather than 10000 or 1000000.

Second, is the simulation running at 100% of cpu? if it is, you've got yourself optimization issues to sort out, if not, it's an issue with the time you are putting into stepsimulation. There is also the possibility that you're just confused as to what a real world speed is supposed to be as others pointed out, since bullet does use mks like units.
labidus
Posts: 7
Joined: Sun Aug 25, 2013 12:40 am

Re: Demos are 10x slower than the real world

Post by labidus »

I use second as double, but i need to multiply by 10 now instead of 100, when i switched from float to double precision i forgot to change my code where i put the delta time for the simulation, now instead of 100 i still need to multiply the gravity by 10

I dont have any issues with the cpu since my game run between 200-800 fps... and the physics is fine whatever fps i am at, but dont understand why i need to multiply the gravity to get it working :(

Also my bsp world is scaled down for bullet, so everything is fine unless they are something i need to setup that i am not aware of.
Post Reply