Moving a circle between two points

Started by
12 comments, last by alex_myrpg 15 years, 4 months ago
I wanted to know how i could tell if a circle could go in between two points without hitting then, and at what angle would this best be done.
Checkout my Journal ( Just started ) for info on my game development status: http://www.gamedev.net/blog/965-ninja-gd/
Advertisement
The direction of motion which allows the largest circle to pass is the direction perpendicular to the line obtained by joining the two points. A circle can pass in that direction between the points without intersecting them only if its diameter is less than the distance between the two points.
thanks, now how about if it approaches not head on but at an angle
Checkout my Journal ( Just started ) for info on my game development status: http://www.gamedev.net/blog/965-ninja-gd/
In the general case of the circle approaching at an angle theta to the line joining the two points, the circle's diameter must be less than [sin(theta) x (distance between two points)] to pass between them. To convince yourself of this condition, draw a diagram where the circle touches just one of the points and then construct a line which is a tangent to the circle and on which the second point lies.
I think the circle could fit through if distanceBetweenPoints * cos(angle) > diameterOfCircle.

That of course assumes the circle travels in a straight line as it passed between the points.
My current game project Platform RPG
Very roughly you can just aim at the midpoint between the two points.

If you want to be more precise then you can calculate the minimum safe distance to pass each point. This gives you an interval from which you can pick the midpoint for the safest shot. If the interval is 'negative' then you know it's impossible. If you allow for the circle to do physics and bounce off the point and then go in, it probably gets even more complicated.

To calculate the minimum safe distance to get the circle past a point, imagine that the point is a circle and the circle is a point and now you're shooting the point so it just clips the circle. [Bleh, getting interrupted. I'll finish this in a bit.]
okay, how would i find the angle to perfectly fit inside
Checkout my Journal ( Just started ) for info on my game development status: http://www.gamedev.net/blog/965-ninja-gd/
What are you actually trying to accomplish? We really need to know this before you can expect a full answer. Also, my first post should effectively answer your most recent question. Turn the inequality into an equation and solve to find:
theta = arcsin((diameter of circle) / (distance between two points))
not sure this is the best way to do it, but making a pool game and have 12 vertices that mark the corners that turn into the pockets
Checkout my Journal ( Just started ) for info on my game development status: http://www.gamedev.net/blog/965-ninja-gd/
Ah, now I understand what you're trying to accomplish... This sounds like a sensible way to check whether the ball will be potted, though of course it won't be completely reliable. However, I suspect it may be best just to use the physics engine to simulate everything.

This topic is closed to new replies.

Advertisement