這是用來檢測兩個圓形是否發生碰撞的碰撞檢測方法。此方法可直接應用於兩個球體。
在此示例中,我們需要定義一些示例變數
- 原點作為 零位置向量。
- 圓形1的中心作為 位置向量。
- 圓形2的中心作為 位置向量。
- 圓形1的半徑,以小數表示。
- 圓形2的半徑,以小數表示。
If
then:
They are not colliding.
If
then:
They are touching.
If
then:
They are colliding.
如果您希望將“接觸”視為“碰撞”,則使用以下方法
If
then:
They are not colliding.
If
then:
They are colliding.
這基本上是上面方法的簡化版本,因為您可以將點視為半徑為零的圓形。
在此示例中,我們需要定義一些示例變數
- 原點作為 零位置向量。
- 點的位置作為 位置向量。
- 圓形1的中心作為 位置向量。
- 圓形的半徑,以小數表示。
If
then:
They are not colliding.
If
then:
They are touching.
If
then:
They are colliding.
如果您希望將“接觸”視為“碰撞”,則使用以下方法
If
then:
They are not colliding.
If
then:
They are colliding.
YouTube
- 涵蓋“圓形與圓形”和“圓形與點”