HELP / ADVICE: Would this be suitable to perform a basic collision?

  • Thread starter Thread starter Brian Basquille
  • Start date Start date
B

Brian Basquille

Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction opposite
to which it was struck (as a said before, a simple collision). How would i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean. This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquilletj/airhockeycollision.jpg

Thanks again all.

Brian
 
I might be missing something here, but doesn't the right angle to the tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't expect the
resulting vector of the red point to be the negative of it's current vector.
Instead, I would think that an addition of the two vectors would be in order.

At least, that's the way it seems to me. Reality may be quite different. ;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce
 
Thanks for the feedback Bruce.

I'm afraid the addition of vectors (etc.) is an area in C# i haven't got
much knowledge about.

Any links / examples to help me think this through.

And if possible, please tell me more about your approach.


Bruce Johnson said:
I might be missing something here, but doesn't the right angle to the
tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't expect
the
resulting vector of the red point to be the negative of it's current
vector.
Instead, I would think that an addition of the two vectors would be in
order.

At least, that's the way it seems to me. Reality may be quite different.
;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

Brian Basquille said:
Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction
opposite
to which it was struck (as a said before, a simple collision). How would
i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right
in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean.
This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquilletj/airhockeycollision.jpg

Thanks again all.

Brian
 
Just so that you know, my knowledge of this is going back about 20+ years to
when I was getting a mathematics degree. If memory serves, there is a right
angle relationship between the momentum of an object before collision and the
resulting momentum of both objects after collision. But I don't think it's
the right angle of the tangent, but that, due to conservation of momentum,
the velocity vectors of the objects after collision form a right angle
triangle with the original momentum vector as the hypotenuse. You've now
exhausted my memory.

I did some quick research, and it seems like the following link contains a
discussion on the topic that you might find useful

http://www.idevgames.com/forum/archive/index.php/t-2963.html

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce



Brian Basquille said:
Thanks for the feedback Bruce.

I'm afraid the addition of vectors (etc.) is an area in C# i haven't got
much knowledge about.

Any links / examples to help me think this through.

And if possible, please tell me more about your approach.


Bruce Johnson said:
I might be missing something here, but doesn't the right angle to the
tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't expect
the
resulting vector of the red point to be the negative of it's current
vector.
Instead, I would think that an addition of the two vectors would be in
order.

At least, that's the way it seems to me. Reality may be quite different.
;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

Brian Basquille said:
Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction
opposite
to which it was struck (as a said before, a simple collision). How would
i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right
in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean.
This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquilletj/airhockeycollision.jpg

Thanks again all.

Brian
 
Much appreciated Bruce!

And thank for the link..... very very useful!!!

Bruce Johnson said:
Just so that you know, my knowledge of this is going back about 20+ years
to
when I was getting a mathematics degree. If memory serves, there is a
right
angle relationship between the momentum of an object before collision and
the
resulting momentum of both objects after collision. But I don't think
it's
the right angle of the tangent, but that, due to conservation of momentum,
the velocity vectors of the objects after collision form a right angle
triangle with the original momentum vector as the hypotenuse. You've now
exhausted my memory.

I did some quick research, and it seems like the following link contains a
discussion on the topic that you might find useful

http://www.idevgames.com/forum/archive/index.php/t-2963.html

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce



Brian Basquille said:
Thanks for the feedback Bruce.

I'm afraid the addition of vectors (etc.) is an area in C# i haven't got
much knowledge about.

Any links / examples to help me think this through.

And if possible, please tell me more about your approach.


message
I might be missing something here, but doesn't the right angle to the
tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't
expect
the
resulting vector of the red point to be the negative of it's current
vector.
Instead, I would think that an addition of the two vectors would be in
order.

At least, that's the way it seems to me. Reality may be quite
different.
;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

:

Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the
direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around
the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction
opposite
to which it was struck (as a said before, a simple collision). How
would
i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which
the
collision between the puck and paddle is first detected). The puck
should
then move in the direction right angles to that line tangeant. Am i
right
in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean.
This
is probably delving more into the Maths area than anything but any
help
would be much appreciated, as i haven't even explored the maths /
angles
side of C# yet.

http://homepage.eircom.net/~basquilletj/airhockeycollision.jpg

Thanks again all.

Brian
 
Back
Top