3
\$\begingroup\$

To detect a collision between two circles, we check if the distance between their centers is smaller than the sum of their radii.

To detect a collision between a slice (in this case half) of a circle and a circle:

  1. Check if the circles are in collision.
  2. Find the two points of the imaginary segment that splits the circle (in the middle).
  3. Check if either of these two points is contained inside the other circle (if so, it is colliding with both slices, red & blue).
  4. If not, compute the angle between the two circles and use that to decide if the circles are touching from one side or the other.

enter image description here

Is there any reasonable way to compute this on moving objects? i.e, so collisions will not be missed because of the discrete nature of frames?

\$\endgroup\$
1
\$\begingroup\$

Swept object collision detection can be challenging but there are some common solutions.

One way is when testing two objects, using the concept of relativity you can set up the math such that one object gains the motion of the other, so that its moving object vs a static object test.

Another way is if you use something like MPR or GJK to do collision detection, you can literally do swept test shapes as if they were just regular objects. (Finding collision time isn't very straightforward though).

Lastly, the simple solution that I've seen used a lot in these situations... Just do multiple tests along the objects paths. Basically just take the large movement and break it into a series of smaller movements, such that you can be sure there won't be missed collisions, and collision test at each step.

Doing something like testing if the line segments of their motion intersects as a "pre filter" is obviously a good idea too (:

\$\endgroup\$
0
\$\begingroup\$

fig1

I'll try a semplified answer. Assuming you store previous frame time and position (and rotation)

calculate point X interpolte dT = frameTime * FrameDistance/(X-PositionC1atFrameA)

Check position of other circle C2 at dT (check if it intersect C1)

Calculate Rot C1 and Rot C2 at dt

finaly apply your logic (points 2,3,4)

EDIT : Found a detailed analisys on problem here: A Sphere-Sphere Sweep Test

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.