-1

This is not a duplicate of this question because I need a way to speed up my world without changing deltaTime and have everything happen faster. Why can't I use deltaTime or change it? I'm using the velocity Verlet sympletic integration for the simulation of orbital mechanics and deltaTime is required to be as low as possible for increased precision. Therefore I have it set to Gdx.graphics.getDeltaTime() * 0.001f. I am using LibGDX in Java and if it is necessary, I am using the Game class to have my screens structured.

What have I tried or thought of?

Using higher order sympletic integrators will not require a smaller deltaTime but are difficult to implement and are my plan B for if this is not possible.

eisa.exe
  • 78
  • 9

1 Answers1

0

The question which you said is not duplicate is actually most likely your solution.

Your goal is to have small time-step of Gdx.graphics.getDeltaTime() * 0.001f. When we use framerate 60fps then it can be writen as 1f / 60f * 0.001f. So your current time-step is about 0.000017. This is the value which you want to use for Constants.TIME_STEP.

Then you will just need to replace WorldManager.world.step with call to your physics function. And the delta time which you pass as parameter will be Constants.TIME_STEP.

But due to your small time-step there will be large amount of calls to the physics function, which means it will have to be fast or you will have to find a way to reduce the time-step anyway.

Jiří
  • 202
  • 2
  • 9
  • I don't know of any WorldManager class? Is that Box2d (I'm not using Box2D im coding my own physics for the fun of it). Nor is there a Constants class in LibGDX. I could be mistaken though. If so, could you link me to an informative page about WorldManager? – eisa.exe Jul 31 '22 at 20:35
  • @eisa.exe Yes, it is correct that you don't have them. As I said you will need to replace `WorldManager.world.step` with call to your own function. And you can use just constant variable instead of whole Constants class. – Jiří Jul 31 '22 at 21:02
  • Ok but how does this speed up anything? This is just setting the speed to TIME_STEP and there is no altering (especially not with TIME_STEP as a constant) – eisa.exe Aug 01 '22 at 09:48
  • @eisa.exe As was said in the question you mentioned, you perform speedup by calling the function in this way `doPhysicsStep(deltaTime * speedup)`. The speedup is performed by the while loop being executed multiple times. – Jiří Aug 01 '22 at 14:48