Answer the question
In order to leave comments, you need to log in
Simulation of body motion in orbit?
Apparently the eye is blurred. I can't find/understand what's wrong.
What I'm trying to do:
A simple simulation of the motion of a body in orbit around a source of gravity.
To do this, a body is randomly set, and for it the following is calculated:
vector directed towards the center of the gravity source => vector of the force of attraction
tangent to the orbit => vector of the object's current velocity (in the first iteration, the calculation is made as the first cosmic one. In subsequent iterations, as the sum of the previous velocity vector and gravity vector in current coordinates)
Expected result:
body moving in a perfectly (well, almost) circular orbit
Result:
In most cases, moving in an elliptical orbit
Suggested cause:
Calculation errors and their sequential accumulation
What will satisfy me as an answer:
A way to significantly reduce these errors or weaken their influence on the model so that visually the orbit looks round, centered on the center of the gravity source
Current implementation:
where:
black body - object in orbit
orange body - source of gravity (fixed/stationary)
red line - connects the centers of the object and the source of gravity
green line - velocity vector directed tangentially to the orbit (increased by an order of magnitude for clarity)
blue line - force vector attraction (for clarity, increased by 2 orders of magnitude)
Answer the question
In order to leave comments, you need to log in
If you have real physical formulas, then I would say that the expected result is the movement of the body in an elliptical orbit.
All bodies in space fly like that.
Moreover, even this shift of the ellipse on each circle is what happens in reality.
Maybe you have a program on the contrary - it works too correctly?
Try to increase the speed, see how the eccentricity of the ellipse changes.
Maybe at some speed the ellipse will become indistinguishable from a circle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question