Collision Detection between Accelerating Spheres

后端 未结 4 1828
Happy的楠姐
Happy的楠姐 2021-02-09 02:39

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well,

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-09 03:18

    Seems like you want the Closest Point of Approach (CPA). If it is less than the sum of the radiuses, you have a collision. There is example code in the link. You can calculate each frame with the current velocity, and check if the CPA time is less than your tick size. You could even cache the cpa time, and only update when acceleration was applied to either item.

提交回复
热议问题