I am working on a simple space simulator. Every time __physics_process executes, I apply gravitational force of a star to a planet and multiply it by delta. Also, when it executes the first time, I apply impulse to the planet, that accelerates it to the first cosmic velocity. But because the gravitational force is devided by delta, the planet flies away. I tried to multiply the impulse by delta too. It makes planet’s orbit more accurate, but it still flies away after orbiting a couple of times
I’m pretty sure when you call apply impulse the outcome is to set it’s velocity based on its mass and the force, without applying a time delta. When you call apply force the time delta is applied for you internally.
You could be calculating your time wrong with the gravity if you use apply force.
If your doing this calculations by hand and modifying velocity on your own. Then I would do the math for what velocity constitutes stable orbit around your stars gravitation and apply the impulse to get you to that velocity. Since impulse is an instantaneous acceleration, of a rigid body, you shouldn’t apply a delta.
I don’t think Godot applies delta internally. So if I don’t apply it, the simulation will be slower on computers with less performance. I mean, not just my program will run slower, but also simulation. Like velocities will be lower, e.g. 100 instead of 200
Well, it’s my fault, I messed up with calculating vector of the force. And when I stopped multiplying force by delta, it works fine. Most likely godot actually applies delta internally.
During integrate_forces, after the forces are accumulated for the frame, and before they are applied, they are multiplied all at once with the time delta p_step.