Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7034781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:13:38+00:00 2026-05-28T01:13:38+00:00

I have circles (there can be more than two) that are moving towards a

  • 0

enter image description here

I have circles (there can be more than two) that are moving towards a point. As of now, they overlap when they are close. How can I make it so they do not intersect, but still move towards the point?

I am using Java.

  • The circles are not balls that follow the laws of physics, they
    represent organisms (irrelevant).
  • I already have collision detection working
  • The circles do not stick together, they simply cannot intersect.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:13:38+00:00Added an answer on May 28, 2026 at 1:13 am

    That’s not an easy question.

    I presume you have some system which computes the coordinates of the circles, renders them, and repeats. These repetitions are called frames.

    Each circle has a vector which describes the direction in which it is supposed to move. On each frame you need to perform collision detection, and change that vector if necessary.

    Collision between any two circles can be detected by checking to see whether the distance between them is smaller than the sum of their radii. The line between the centers of the colliding circles gives you the direction of the collision. The collision vector for a circle is on the direction of the collision, pointing towards the center of the circle, and its magnitude is equal to half the number of units by which the circles overlap, that is, to the sum of their radii minus the distance between them, divided by two. (If the circles can be of unequal sizes it becomes more complicated, you need to figure out by how much to divide.)

    So, one possible solution to your problem would be to simply add the collision vector to the direction vector of the circle and then scale the direction vector so that its magnitude is equal to the magnitude that it had before the collision. (So that only its direction will be adjusted, not its magnitude.)

    Note that this will only work for the specific description that you gave, where you want the balls to stick together and continue moving towards the point; if you wanted a more realistic effect, you would need to emulate billiard balls type of physics.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSView in which the user can draw circles. These circles are
I have two 2d circles in 3d space (defined by a center, normal, and
I am creating an app where there will be ~10 circles on screen, that
I have a panel that is filled with a large number of circles (Ellipse2D).
In some of our projects, there's an class hierarchy that adds more parameters as
Very simple Qt GUI application: On the scene I have multiple circles implemented as
Is it possible to have the radiating circles like the user location annotation. So
Going round in circles here i think. I have an activity called Locate; public
I've been going around in circles for hours with this. I have a UserProfile
Keep going around circles, but I am still unclear about this. Have a feeling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.