Shape touching shape

Hello,
as I am writing Dubtank 2, I came across a problem.
I want to detect whether a tank touches another tank. I know or I can calculate the exact position of all points and detecting crossing straight line segments is easy. The problem begins with detecting ellipses touching line seqments. There could be a moment where an ellipse touches a line segment between its 2 points. I know it can be done with trigoniometry, but I have no idea, how…

Hello @FurryNightShade!
Here’s a resource that could possibly help you out. It covers different cases of collision detection, and your particular case of Line/Circle collision detection can be found here.

If you’re still facing issues, feel free to post your code here.

2 Likes

Shameless self-promotion: here is a tutorial on collision detection in Processing:

In general, you can google something like “ellipse line segment collision detection” for a ton of results. Don’t be afraid to do some research.

Thanks to both of you. That is, what I’m looking for.