Collision of Two Circles

后端 未结 3 2096
失恋的感觉
失恋的感觉 2021-01-17 05:57

Hey i am writing a program in java (but i think thats not that relevant for this question), where two robots (circles) are driving arround. A robot is driving with a certain

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-17 06:32

    There is a simple way of checking if the circles are colliding; if the distance between both circles is smaller than the sum of the radius of both, then it means they are colliding.

    To check if the collision is incoming, check if the distance between both circles is smaller than the sum of the radius of both AND a small value, and if in the next tick this value is even smaller.

提交回复
热议问题