2D orbital physics

前端 未结 2 1469
面向向阳花
面向向阳花 2021-02-02 15:55

I\'m working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I\'ll have to upgrade eventually); I can push t

2条回答
  •  醉话见心
    2021-02-02 16:23

    Yes, these equations hold in 2D space, because your 2D space is just a 2D representation of a 3D world. (A "real" 2D universe would have different equations, but that's not relevant here.)

    A long shot: Are you perhaps using distance to the surface of the planet as r?

    If that isn't it, try cutting your time step in half; if that makes a big difference, keep reducing it until the behavior stops changing.

    If that makes no difference, try setting the initial velocity to zero, then watching it fall for a few iterations and measuring its acceleration to see if it's GM/r2. If the answer still isn't clear, post the results and we'll try to figure it out.

提交回复
热议问题