Re:
by hermitcrab on Wednesday November 19, 2025 @09:01AM
(#45979594)
Excellent work. Is this based on simple Newtonian gravity applied over a uniform time-step, or something more sophisticated?
[ Parent
| on HN ]
For accuracy, time step can get smaller when bodies are closer.
Re:
by hermitcrab on Wednesday November 19, 2025 @12:46PM
(#45982440)
Yes, but this would slow the simulation right down if 2 bodies are very close. I think people sometimes use a 'fudge factor', e.g. if distance < x then treat distance as x.
Re:
by hermitcrab on Wednesday November 19, 2025 @12:51PM
(#45982504)
>'fudge factor'
Maybe that is what the 'softening' parameter relates to?
Yes, the softening factor keeps the forces from getting too big when bodies get close together. Better for the visualization but not very accurate to leave it in.
Re:
by hermitcrab on Wednesday November 19, 2025 @03:19PM
(#45984576)
Better than things flying off to infinity or the whole simulation slowing right down.
Re:
by constantcrying on Wednesday November 19, 2025 @10:33AM
(#45980845)
What you describe is the Euler method, which is well known for being a comparatively bad choice in most situations. The ODE solver can be selected, the default is RK4, which is a Runge–Kutta method of 4th order, it computes the next time step by combining the values at 4 previous time steps.
Re:
by hermitcrab on Wednesday November 19, 2025 @12:52PM
(#45982513)
I see it now, under the 'Advanced' options.