Collision between Two Circles

Good Afternoon,

I’m working on collision detection between 2 circles, using the distance equation. I have written the functions:

CircleCircle(c1xPos,c2xPos,c1yPos,c2yPos) = √((c1xPos - c2xPos)^2) + ((c1yPos - c2yPos)^2)
OnCollisionCircle = {CircleCircle(c1x, c2x, c1y, c2y) ≤ (c1r + c2r): 1, 0}

OnCollisionCircle returns 1 if the circles are colliding, or 0 if they aren’t. How do I make the two circles collide with one another? Desmos senses when they are colliding, but how do I stop them from intersecting one another?

My project can be found at: Physics Engine (Optimized) | Desmos

I’m not sure how you’d physically stop the movement without a ticker. But if you’re looking to create something dynamic I think something like this would be an initial step. Just include a little loop that moves the larger circle when the smaller one triggers the 1 condition.

I may have overcomplicated it, but I created a new variable with a condition that if they’re not colliding, circle 2 moves freely, but if they are colliding, c2 is restricted to a position just touching the circle.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.