Hey! So I don't know very many proprieties about Box2d. Would it be a bad idea to change my Time Step to a number more like 1/10 instead of the 1/30 I see so many people using?
TimeStep question
FlashAs the value is 1/30, i guess, it will update 30 times in 1 second (im not 100% sure, as i am pretty new to box2d
myself^^). That means, if you use 30FPS it updates every frame. So if you use 1/10 instead, it only updates every 3rd
frame. The only reason to use a lower amount, could be a better performance, i can't think of any other one.
myself^^). That means, if you use 30FPS it updates every frame. So if you use 1/10 instead, it only updates every 3rd
frame. The only reason to use a lower amount, could be a better performance, i can't think of any other one.
The time step simply tells you how far things move per tick.
IE: You have a ball that is falling. The next frame will be where the ball is ____ seconds later.
At 1/30, every time you call STEP the simulation advances 0.03 seconds.
At 1/10, every time you call STEP the simulation advances 0.1 seconds.
At 181440, every time you call STEP the simulation advances 18 weeks.
1/30 is often used because people want the framerate of Flash to match up to the framerate of your physics simulation. As long as things don't get bogged down, then you'd be seeing a 1:1 real life simulation in terms of time.
If flash is firing 30 times per second and your simulation is advancing only a 10th of a second (1/10), then after 1 second of running flash your simulation will be sitting at 3 seconds, making it seem "sped up" like watching those old-time movies.
So depending on your situation it's completely up to you on how you want to run it. I wanted one of my games to move a bit slower so I cranked it up to 1/100.
IE: You have a ball that is falling. The next frame will be where the ball is ____ seconds later.
At 1/30, every time you call STEP the simulation advances 0.03 seconds.
At 1/10, every time you call STEP the simulation advances 0.1 seconds.
At 181440, every time you call STEP the simulation advances 18 weeks.
1/30 is often used because people want the framerate of Flash to match up to the framerate of your physics simulation. As long as things don't get bogged down, then you'd be seeing a 1:1 real life simulation in terms of time.
If flash is firing 30 times per second and your simulation is advancing only a 10th of a second (1/10), then after 1 second of running flash your simulation will be sitting at 3 seconds, making it seem "sped up" like watching those old-time movies.
So depending on your situation it's completely up to you on how you want to run it. I wanted one of my games to move a bit slower so I cranked it up to 1/100.
That makes sense. Well I'm keepin my framerate at a huge number... 80, so way up there. I find when it's at 1/30, it just moves too slow for my liking, so I moved it down to 1/12 which looks pretty darn good to me for what I'm making. I guess it just comes down to personal preference. Good to know how the Time Step works though 🙂 thanks a lot!
Original thread: https://box2d.org/forum/viewtopic.php?t=3223