-2

I can find IF two objects collide, but not the point in which they DO, I have seen other posts asking similar questions, but the answers have always been too cryptic/made large assumptions on the knowledge of the user, and were always for other languages. I am working on a program where a person launches a pipe Bomb, the speed and displacement accounting for rotational velocity, gravity, air resistance, and mass. In my scenario there are only two times at current, in which an actual collision can occur: first when the pipe bomb hits one of the four walls and second, when the object hits the explosion of another pipe bomb.

Theoretically I can figure out how to do collision for the pipe bomb and a wall (The pipe bomb 's collision is a square) because the pipe bomb can only collide while facing completely perpendicular to the wall, parallel, or hitting on one of its four corners (I could figure this out using the rotation of the pipe bomb). When I try to figure this out when the pipe bomb hits the circular explosion of another pipe bomb I'm stumped, because theoretically it could be anywhere on any side of the pipe bomb because a circle doesn't have flat edges.

My plan was to find the point on the pipe bomb where it intersected anything, get the radius from the center of mass of the pipe bomb, and find the torque from the force being applied by the explosion (Which radius increases as time goes up, but force decreases until it hits zero, and it disappears), or the inverse force from the ricochet off of the wall.

Below WOULD have been a image that shows two moments of collision in my program to show my point, but I apparently can't do that yet...

Krupip
  • 4,404
  • 2
  • 32
  • 54

1 Answers1

0

Since the wall is basically a vertical line, you can just use this as a guide for predicting the point(s) of collision.

David
  • 877
  • 1
  • 7
  • 18
  • @user2036035 Since when were we talking about circles? – David Feb 02 '13 at 22:24
  • oops, I clicked another link within that one by accident and didn't realize it. – Krupip Feb 02 '13 at 22:29
  • @user2036035 It's all good. Just be sure to close this question as it's irrelevant now. – David Feb 02 '13 at 22:31
  • I looked through what the program would do, and it would be fine if my object was static, or if it had a fixed angle trajectory, but the problem again, comes from the fact it is a rotating rectangle, and not a circle or square. – Krupip Feb 02 '13 at 23:41
  • @user2036035 If you look at the Final Result Preview, you can see that you can control the angle of the object to see where it'll collide. Also, if the issue comes from the fact that the object you're using is not a square, then you can always simplify the rectangle into 2 squares with a gap in the middle. – David Feb 03 '13 at 00:18
  • but then I have to account for an infinite amount of points on the square do I not? The point I was trying to make is that I do not know the point on the rotating square that is going to intersect, I'm not looking for were the square will intersect, I am looking for where a part of the circle will intersect the square. – Krupip Feb 03 '13 at 04:08
  • @user2036035 http://active.tutsplus.com/tutorials/games/quick-tip-collision-detection-between-a-circle-and-a-line-segment/ – David Feb 04 '13 at 03:03
  • This is great! I should be able to find the point of contact no matter the rotation with this! Thanks for your help. – Krupip Feb 04 '13 at 15:37
  • @user2036035 Alright then. Be sure to close this question once you're finished. – David Feb 04 '13 at 15:53